hdu1412

View Code
   
     
#include " iostream "
#define M 20000
#include
" algorithm "
using namespace std;
int c[M];
int main()
{
int n,m;
int a,b;
int i,j;
while (cin >> n >> m)
{
int k = 0 ;
for (i = 0 ;i < n;i ++ ) { cin >> a; c[k ++ ] = a;}
for (i = 0 ;i < m;i ++ ) { cin >> b; c[k ++ ] = b;}
sort(c,c
+ k);
for (i = 0 ;i < k;i ++ )
{
if (c[i] != c[i + 1 ])
{
cout
<< c[i];
if (i != k - 1 ) cout << " " ;
}
}
cout
<< endl;
}
return 0 ;
}

你可能感兴趣的:(HDU)