来源:HDU1412
试一下set的迭代器
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
set<int>s1;
int main(){
int n,m;
while(scanf("%d%d",&n,&m)!=EOF){
int du;
s1.clear();
for(int i=1;i<=n;i++) {
scanf("%d",&du);
s1.insert(du);
}
for(int i=1;i<=m;i++) {
scanf("%d",&du);
s1.insert(du);
}
set<int>::iterator it;
it = s1.begin();
printf("%d",*it);
it ++;
for(; it != s1.end() ; it++) {
printf(" %d",*it);
}
puts("");
}
return 0;
}