对一组输入的数据进行排序。
对输入的数据,我们有如下的约定:所有的输入数据都为正整数,且都不大于300000000。但是输入的数据可能会有重复,排序时,应将重复的数据合并,即同样的数只处理一次。
输入格式
只有一组数据,以0结尾。
输出格式
输出排序后的数据(不含0),其中相同的数应只显示1个。
样例输入
12500000 10000000 12500000 0
样例输出
10000000 12500000
拿个集合存存输出就完了
#include<iostream>
#include<set>
using namespace std;
int main(){
int n;
set<int> jihe;
while(cin>>n){
if(n==0)
break;
jihe.insert(n);
}
for(set<int>::iterator it=jihe.begin();it!=jihe.end();++it){
if(it!=jihe.begin())
cout<<" ";
cout<<*it;
}
return 0;
}