hdu 1412 {A} + {B}
题目连接
http://acm.hdu.edu.cn/showproblem.php?pid=3282
{A} + {B}
Description
给你两个集合,要求{A} + {B}.
注:同一个集合中不会有两个相同的元素.
Input
每组输入数据分为三行,第一行有两个数字$n,m(0 < n,m \leq 10000)$,分别表示集合A和集合B的元素个数.后两行分别表示集合A和集合B.每个元素为不超出int范围的整数,每个元素之间有一个空格隔开.
Output
针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.
SampleInput
1 2
1
2 3
1 2
1
1 2
SampleOutput
1 2 3
1 2
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
using std::cin;
using std::cout;
using std::endl;
using std::find;
using std::sort;
using std::set;
using std::map;
using std::pair;
using std::vector;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define iter(c) decltype((c).begin())
#define cls(arr,val) memset(arr,val,sizeof(arr))
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
const int Max_N = ;
typedef unsigned long long ull;
set<int> res;
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
int n, m, v;
while (~scanf("%d %d", &n, &m)) {
rep(i, n + m) scanf("%d", &v), res.insert(v);
iter(res) it = res.begin();
printf("%d", *it++);
for (; it != res.end(); ++it) printf(" %d", *it);
putchar('\n');
res.clear();
}
return ;
}
hdu 1412 {A} + {B}的更多相关文章
- HDOJ(HDU).1412 {A} + {B} (STL SET)
HDOJ(HDU).1412 {A} + {B} (STL SET) 点我挑战题目 题意分析 大水题,会了set直接用set即可. 利用的是set的互异性(同一元素有且仅有一项). #include ...
- hdu 1412 (STL list)
简单例题 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1412 list 相关博客:http://www.cnblogs.com/fangyukuan/a ...
- D题 hdu 1412 {A} + {B}
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1412 {A} + {B} Time Limit: 10000/5000 MS (Java/Others ...
- C++ STL中的 Set的用法
https://blog.csdn.net/yas12345678/article/details/52601454 -----源头此处 1.关于set的概念 set 是STL中的集合. 集合 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
随机推荐
- 【测试】trunc和round的区别
trunc是截断:round是四舍五入:下面通过一个例子具体看一下trunc和round的不同 SQL),trunc() from dual; TRUNC() TRUNC() ------------ ...
- My Rules of Information
http://www.infotoday.com/searcher/jan02/block.htm I often suggested to students that information is ...
- check version cordova
cordova plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git 这个插件很简单,但是要注意点的是:需 ...
- java 进制相互转换
public class test{ public static void main(String[]args){ //十进制转二进制. public static void toBin(int nu ...
- Chrome 使用技巧
阅读目录 写在前面 快速切换文件 在源代码中搜索 在源代码中快速跳转到指定的行 使用多个插入符进行选择 设备模式 设备传感仿真 格式化凌乱的js源码 颜色选择器 改变颜色格式 强制改变元素状态(方便查 ...
- 定时器Timer
定时器类:Timer 构造函数:Timer(TimerCallback callback, object state, uint dueTime, uint period) callback:中断处理 ...
- PayPal 开发详解(二):开启【自动返回】和【数据传输】
1.使用我们的商家测试帐号登录 sandbox :http://www.sandbox.paypal.com Business帐号登录 2.登录以后点击:[我的paypal]->[用户信息]-& ...
- 在vs2005中使用SVN进行版本管理
1.软件准备 VisualSVN-Server-2.5.10.msi SVN服务端 WindowsXP-KB942288-v3-x86.exe XP中安装TortoiseSVNSVN1.8必须 Tor ...
- AnyCAD C++ SDK与OpenCASCADE互操作
AnyCAD SDK有.Net和C++两个版本,使用C++版本的AnyPlatformOcc模块可以实现与OpenCASCADE互操作. C++版本(VS2010 32bit)下载 在AOBridge ...
- MySQL深入利用Ameoba实现读写分离
3 ameoba安装配置 3.1 安装配置JDK [root@stu15 ~]# rpm -ivh jdk-7u67-linux-x64.rpm [root@stu15 ~]# cd /usr/j ...