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;
}
#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 5366】The mook jong 详解
- 【HDU 2136】Largest prime factor 详细图解
- 【HDU 1568】Fibonacci 数学公式 详解
- HDU 1568
- HDU1290
- HDU1568(Fobonacci公式)
- HDU ACM Step 2.2.2 Joseph(约瑟夫环问题)
- HDU 1405
- HDU 1297
- hdu 1205
- hdu 2087
- hdu 1016
- HDU 4898 The Revenge of the Princess’ Knight ( 2014 Multi-University Training Contest 4 )
- HDU 5592 ZYB's Premutation 线段树(查找动态区间第K大)
- HDU 5240 Exam (好水的题)
- HDU5237 Base64 大模拟
- HDU 1000
- HDU 1001
- 2015-11-11 hdu新生赛 A题(AC)
- 2015-11-11 hdu新生赛 C题(结束后一发AC)