题解列表

筛选

要用long long

摘要:解题思路:注意事项:参考代码:#include<stdio.h>long long cal(int i){    if(i==1)    {        return 1;    }else{   ……

2909: 直方图 C++

摘要:解题思路:注意事项:const int  常量(不会改变)cnt[a[i]]      cnt    数量参考代码:#include<bits/stdc++.h>using namespace std……

用头文件更快捷

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<string.h>#include<ctype.h>int main(){    char s[300];    ge……

c语言递归解法

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int gcd(int a,int b){   (a%b==0)  ?   return b  :  return gcd(b,a%b)……

题解 1738: 排序

摘要:下面是选择排序 #include using namespace std; int a[5010]; int main() { int n; ……

1738: 排序 C++!

摘要:解题思路:std::sort   最坏时间复杂度0(nlogn)注意事项:参考代码:#includeusing namespace std;int a[5000];int main(){ int n;……

分数列奇偶来分别分析,易于看懂。

摘要:解题思路:  将数列分奇数列和偶数列,最大生长数其实就是2*m-2,也就是循环一次即可,而数列两边实对称的,由此可得。注意事项:  注意m在循环中的取值,切记数组底数从零开始参考代码:#include……

字符数组解Tom数

摘要:解题思路:因为int范围最高到2的31次方-1,所以改为数组注意事项:参考代码: char str[100];   while(~scanf("%s",str))   {       int l,su……