lxj | We have carefully selected several similar problems for you: 1408 1720 1407 1229 1431
#include<iostream> #include<set> using namespace std; int main() { int a,b,m; while(cin>>a>>b) { set <int> s; set<int>::iterator str; for(int i=0;i<a;i++) { scanf("%d",&m); s.insert(m); } for(int i=0;i<b;i++) { scanf("%d",&m); s.insert(m); } for(str=s.begin();str!=s.end();str++) { if(str==s.begin()) cout<<*str; else cout<<" "<<*str; } cout<<endl; } return 0; } 这个代码有一点不规范,我写的时候忘了,应该把s先清0的