注:同一个集合中不会有两个相同的元素.
Input 每组输入数据分为三行,第一行有两个数字n,m(0
1 2 1 2 3 1 2 1 1 2
Sample Output
1 2 3 1 2看到大神用STL,写的如此犀利,忍不住来一发。。
#include#include #include #include #include #include using namespace std; int main() { int n,m,x; list
s1; list s2; while(cin>>n>>m) { for(int i=0;i >x; s1.push_back(x); } for(int i=0;i >x; s2.push_back(x); } s1.merge(s2); s1.sort(); s1.unique(); int cnt=0; while(!s1.empty()) { if(!cnt) cout<