频道栏目
首页 > 资讯 > C++ > 正文

HDU 1412 {A} + {B}

14-08-07        来源:[db:作者]  
收藏   我要投稿
Problem Description 给你两个集合,要求{A} + {B}.
注:同一个集合中不会有两个相同的元素.
Input 每组输入数据分为三行,第一行有两个数字n,m(0
Output 针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.
Sample Input
1 2
1
2 3
1 2
1
1 2

Sample Output
1 2 3
1 2
看到大神用STL,写的如此犀利,忍不住来一发。。
#include
#include
#include
#include
#include
#include
using namespace std;

int main()
{
    int n,m,x;
    lists1;
    lists2;
    while(cin>>n>>m)
    {
        for(int i=0;i>x;
            s1.push_back(x);
        }
        for(int i=0;i>x;
            s2.push_back(x);
        }
        s1.merge(s2);
        s1.sort();
        s1.unique();
        int cnt=0;
        while(!s1.empty())
        {
           if(!cnt)
                cout<


相关TAG标签
上一篇:spring+websocket整合(springMVC+spring+MyBatis即SSM框架和websocket技术的整合)
下一篇:Atitit.现实生活中最好使用的排序方法-----ati排序法总结
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站