题解列表

筛选

最短代码解决奇偶数之和

摘要:解题思路:使用求和公式。偶数求和公式为(n / 2) * (n / 2 + 1),奇数求和公式为(n / 2) * (n / 2)或(n / 2) * (n / 2)+n。注意事项:奇数和与偶数和求和……

erase的大作用

摘要:#include<bits/stdc++.h> using namespace std; int main() {     int t,i=0;     cin>>t;     while……

1852: 求1+2+3+...+n的值

摘要:解题思路:用for循环,从1累加到n。注意事项:n<=1000000000,变量得开long long。参考代码:#include<bits/stdc++.h>using namespace std;……

c++的compare就是c的strcmp

摘要:#include<bits/stdc++.h> using namespace std; int main() {     string s[3];     cin>>s[0]>>s[1]>……