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. ...
随机推荐
- 【PL/SQL练习】DML语句的处理(可以处理多行数据)
1.Insert (在表中插入一行数据,并查看) SQL> desc t1; Name Type Nullable Default Comments ---- ------------ ---- ...
- EB(存储单位)
abbr.艾字节,1EB=1024PB 计算机的存储单位 位 bit (比特)(Binary Digits):存放一位二进制数,即 0 或 1,最小的存储单位. 字节 byte:8个二进制位为一个字节 ...
- java.lang.IllegalArgumentException
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste ...
- 华为OJ平台——字符串分隔
题目描述: 连续输入字符串,请按长度为8拆分每个字符创 后输出到新的字符串数组: 长度不是8整数倍的字符串请在后面补数字0,空字符串不处理 输入 连续输入字符串(输入两次,每个字符长长度小于100)输 ...
- CDbConnectionExt.php 23.2实现数据库的主从分离,该类会维护多个数据库的配置:一个主数据库配置,多个从数据库的配置
<?php /** * 实现数据库的主从分离,该类会维护多个数据库的配置:一个主数据库配置,多个从数据库的配置. * 具体使用主数据库还是从数据库,使用如下规则: * 1.CDbComm ...
- select修改原生样式组件
<div class="select"> <select class="" name=""> <option ...
- 电脑U盘启动总结
1:联想G410(笔记本) FN+F2:进入BIOS,FN+F12,快速启动选择. boot mode—>Legacy support,boot priority—>Legacy firs ...
- Javascript 常用系统内置函数
1:在数组指定位置插入元素 array.splice(2, 0, "three"); //在索引2的位置,删除0个元素后,插入元素“three” 例子: // 原来的数组 va ...
- 第四章_PHP基本语法
1.第一个PHP程序 //弱爆了有木有 <?php echo "Hello PHP!'; ?> 2.PHP共支持8种基本数据理性,包括4种标量类型:boolean(布尔型).in ...
- 自定义Attribute 服务端校验 客户端校验
MVC 自定义Attribute 服务端校验 客户端校验/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) *//* Autho ...