您的位置:首页 > 其它

hdu1412 {A} + {B}(set水)

2016-03-14 08:38 141 查看
学了set这题要再做不出来一头撞死得了= =

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <set>
#include <ctype.h>
#include <string.h>
using namespace std;

const int N = 50010;
const int INF = 1000000;

int main()
{
// freopen("in.txt", "r", stdin);
int n, m, num;
while(~scanf("%d%d", &n, &m))
{
set <int> s;
for(int i = 0; i < n; i ++)
{
scanf("%d", &num);
s.insert(num);
}
for(int i = 0; i < m; i ++)
{
scanf("%d", &num);
s.insert(num);
}
cout << *s.begin();
s.erase(s.begin());
for(set<int>::iterator it = s.begin(); it != s.end(); it ++)
cout << " "<< *it;
printf("\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hdu