使用sort函数排序 摘要:解题思路:使用sort函数直接排序然后相减把结果相加注意事项:参考代码:#include<bits/stdc++.h>using namespace std;bool compare(int a,in…… 题解列表 2024年10月29日 0 点赞 0 评论 331 浏览 评分:7.3
开心的金明-背包问题解法 摘要:解题思路:可归纳为背包问题注意事项:放入二维数组的是单件物品*权重参考代码:#include<stdio.h>int max(int a,int b){ int max=0; max = …… 题解列表 2024年10月29日 0 点赞 0 评论 338 浏览 评分:0.0
2847 找第一个只出现一次的字符(gets) 摘要:解题思路:注意事项:参考代码#include <stdio.h>#include <string.h>int main() { char arr[100001], ch; int i, j…… 题解列表 2024年10月29日 0 点赞 0 评论 300 浏览 评分:0.0
青蛙过河--大致思路 摘要:解题思路:二分 + 前缀和y: 跳跃青蛙跳到对岸,应该满足的基本条件是任意相邻的两点距离<=跳跃能力如果存在相邻的两点距离>跳跃能力,则这两点中间一定存在y区间为空区间如果任意相邻的两点距离<=跳跃能…… 题解列表 2024年10月29日 0 点赞 0 评论 356 浏览 评分:0.0
应该行数算少然后比较清晰了 摘要:解题思路:调用sscanf函数注意事项:参考代码:#include <stdio.h>#include <string.h>#include <stdlib.h>int is_ip(char *ip_…… 题解列表 2024年10月29日 0 点赞 0 评论 284 浏览 评分:9.9
汽水瓶:第二种解法 摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include <string.h>int main(){ int n,b,a,m,j=0; while(scanf("%d",&n…… 题解列表 2024年10月28日 1 点赞 0 评论 142 浏览 评分:2.0
可以在输入的时候同时统计最大最小值 摘要:```c #include int main(){ int n; scanf("%d",&n); int arr[n]; int max=0,min=0,…… 题解列表 2024年10月28日 0 点赞 0 评论 238 浏览 评分:0.0
用结构体数组和qsort排序 摘要:先给字符串排序,然后使用结构体数组来存储出现过的字母,同时统计同一字符出现过的次数,因为已经排好序了,所以很容易统计。在统计的时候顺便把最大次数找出来,之后遍历结构体数组找最大次数就行了。 ```c…… 题解列表 2024年10月28日 0 点赞 0 评论 171 浏览 评分:9.9
把数字转换成字符串,这样就好处理了 摘要:思路很简单,运用sprintf函数把数字转换成字符,这样年就是数组下标0-3,月就是4-5,日就是6-7,然后判断一下是不是回文就行了。 ```c #include #include…… 题解列表 2024年10月28日 2 点赞 0 评论 306 浏览 评分:9.9
1812: [编程基础]输入输出练习之输出图案题解 摘要:解题思路: 一般用多层嵌套循环来实现输出。注意事项: 当输出的等腰三角形结构比较固定时,用这种方法可以不需要多层嵌套循环,直接通过setw()与setfill()配合使用来控制空格和字符的数量。但如果…… 题解列表 2024年10月28日 0 点赞 0 评论 386 浏览 评分:0.0