题意:两个整数集合 合并,并且从大到小输出
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
set<int>str;
int n, m;
int c;
int main()
{
int a;
while (cin >> n >> m)
{
c = 0;
str.clear();
while (n--)
{
cin >> a;
if (str.find(a) == str.end())
{
str.insert(a);
c++;
}
}
while (m--)
{
cin >> a;
if (str.find(a) == str.end())
{
str.insert(a);
c++;
}
}
int cc = 0;
for (set<int>::iterator it = str.begin(); it != str.end(); ++it)
{
cout << *it ;
cc++;
if (cc != c)
{
cout << " ";
}
}
cout << endl;
}
return 0;
}