京东笔试题—集合问题
本地编译结果正确,在网上却说编译结果错误;求大牛看看哪有问题 #include<set> #include<iostream> using namespace std; int main() { set<int>set1; int n,m,a,b; cin>>n>>m; for(int i =0;i<n;i++) { cin>>a; set1.insert(a); } for(int j=0;j<m;j++) { cin>>b; set1.insert(b); } set<int>::iterator set1_iter; for(set1_iter = set1.begin();set1_iter != set1.end();set1_iter++) { cout<<*set1_iter<<" "; } cout<<endl; }