题解列表
The 3n + 1 problem
摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in……
字符串的输入输出处理
摘要:解题思路:前面需要整体输出,则用for循环和string逐次输出,后面需要换行输出则用cin即可注意事项:使用getline时需要调用头文件string参考代码:#include<iostream>u……
关于读取空格:cin,cin.get,getline,cin.getline及计算长度:sizeof,strlen,length,size
摘要:解题思路:用字符串数组录入数据再反向输出即可注意事项:使用strlen时需包含头文件#include<bits/stdc++.h>,否则网页编译器报错cin:常用于c++中读取数据,但遇到空格和回车即……
A+B for Input-Output Practice (VII)
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b; while (cin >> a>>b) { ……
A+B for Input-Output Practice (VI)
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b,c,sum=0; while (cin >> a) ……
A+B for Input-Output Practice
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b,c,sum=0; cin >> c; while (……
A+B for Input-Output Practice (V)
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b,c,sum=0; cin >> c; while (……
A+B for Input-Output Practice (IV)
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b,sum=0; while (cin >> a && ……
A+B for Input-Output Practice (III)
摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int a, b; while(cin>>a>>b) { if (a……