输入输出典型题链接
int类
1(典型)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223347207.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
{
cout<<a+b<<endl;
}
}
2(典型)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223600376.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
return 0;
}
3(典型)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223640810.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
{
if(a==0&&b==0) break;
cout<<a+b<<endl;
}
return 0;
}
4
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223728962.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
while(cin>>t)
{
if(t==0)break;
int res=0;
while(t--)
{
int x;
cin>>x;
res+=x;
}
cout<<res<<endl;
}
return 0;
}
5
![在这里插入图片描述](https://img-blog.csdnimg.cn/2021021522381567.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int x;
cin>>x;
int res=0;
while(x--)
{
int y;
cin>>y;
res+=y;
}
cout<<res<<endl;
}
return 0;
}
6
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223855479.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
while(cin>>x)
{
int res=0;
while(x--)
{
int y;
cin>>y;
res+=y;
}
cout<<res<<endl;
}
return 0;
}
7
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215223910825.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
int res=0;
while(cin>>x)
{
res+=x;
if(cin.get()=='\n')
{
cout<<res<<endl;
res=0;
}
}
}
string
1
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215224108230.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
set<string> res;
while(n--)
{
string x;
cin>>x;
res.insert(x);
}
int i=0;
for(auto elem:res)
{
i++;
cout<<elem;
if(i==n-1) cout<<endl;
else cout<<" ";
}
return 0;
}
2(重点)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215224144650.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
using namespace std;
int main()
{
string x;
set<string> res;
while(cin>>x)
{
res.insert(x);
if(cin.get()=='\n')
{
int i=0;
for(auto elem:res)
{
i++;
cout<<elem;
if(i==res.size())
{
res.clear();
cout<<endl;
}
else cout<<" ";
}
}
}
return 0;
}
3(重点)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210215224345815.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ZseXRvd25z,size_16,color_FFFFFF,t_70)
#include <bits/stdc++.h>
using namespace std;
int main(){
string input;
while(getline(cin, input)){
stringstream iss(input);
string temp;
vector<string> vs;
while(getline(iss, temp, ',')){
vs.push_back(temp);
}
sort(vs.begin(), vs.end());
int len = vs.size();
for(int i = 0; i < len - 1; i++){
cout << vs[i] << ",";
}
cout << vs[len - 1] << endl;
}
return 0;
}