HDUOJ {A}+{B}
来源:互联网 发布:网络问政的特点 编辑:程序博客网 时间:2024/06/09 21:27
{A} + {B}
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21951 Accepted Submission(s): 9050
Problem Description
给你两个集合,要求{A} + {B}.
注:同一个集合中不会有两个相同的元素.
注:同一个集合中不会有两个相同的元素.
Input
每组输入数据分为三行,第一行有两个数字n,m(0<n,m<=10000),分别表示集合A和集合B的元素个数.后两行分别表示集合A和集合B.每个元素为不超出int范围的整数,每个元素之间有一个空格隔开.
Output
针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.
Sample Input
1 212 31 211 2
Sample Output
1 2 31 2
Author
xhd
Source
HDU 2006-5 Programming Contest
Recommend
lxj | We have carefully selected several similar problems for you: 1408 1720 1407 1229 1431
#include<iostream>#include<set>using namespace std;int main(){int a,b,m;while(cin>>a>>b){set <int> s;set<int>::iterator str;for(int i=0;i<a;i++){scanf("%d",&m);s.insert(m);}for(int i=0;i<b;i++){scanf("%d",&m);s.insert(m);}for(str=s.begin();str!=s.end();str++){if(str==s.begin())cout<<*str;elsecout<<" "<<*str;}cout<<endl;}return 0;}这个代码有一点不规范,我写的时候忘了,应该把s先清0的
阅读全文
1 0
- HDUOJ A+B
- HDUOJ 1228 - A+B
- HDUOJ 1412 - {A} + {B}
- HDUOJ {A}+{B}
- HDUOJ A+B 题目1000
- hduoj 2033 人见人爱A+B
- HDUOJ - 2054 A == B ?
- HDUOJ关于A+B的ti
- HDUOJ 又一版A+B 题目1877
- HDUoj 1576 A/B 扩展欧几里德
- hduoj As Easy As A+B 题目1040
- hduoj 1002 A + B Problem II(大数加法)
- HDUoj 1412 {A} + {B} ( set &去重函数
- A Magic Lamp(HDUOJ 3183)
- HDUOJ 1698 Just a Hook
- HDUOJ A Mathematical Curiosity 1017
- hduoj A strange lift---1548
- HDUOJ
- android 怎么将activity 退出的动画效果关闭
- 百度地图多点聚合(标注与信息窗口)最佳视野
- JS编程-寻找字符串中出现最多的字符以及重复次数
- 2017/8/5训练日记(最短路径算法之Dijkstra算法和Bellman-Ford算法)
- 事务管理之事务的基本概念总览
- HDUOJ {A}+{B}
- POJ 2968 The Pilots Brothers' refrigerator(DFS)
- HDU4876(深搜+剪枝+全排列)
- mybatis级联映射
- 【react】利用shouldComponentUpdate钩子函数优化react性能以及引入immutable库的必要性
- django允许外部访问
- 常用HTML标签学习笔记1
- python系列之numpy模块学习
- 解决unity无法添加环境音效的问题,曲线调整深度理解。(最新版unity2017)