zoukankan      html  css  js  c++  java
  • {A} + {B}

    http://acm.hdu.edu.cn/diy/contest_showproblem.php?pid=1005&cid=22619



    Problem Description

    给你两个集合,要求{A} + {B}.
    注:同一个集合中不会有两个相同的元素.

    Input

    每组输入数据分为三行,第一行有两个数字n,m(0<n,m<=10000),分别表示集合A和集合B的元素个数.后两行分别表示集合A和集合B.每个元素为不超出int范围的整数,每个元素之间有一个空格隔开.

    Output

    针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.

    Sample Input

    1 2
    1
    2 3
    1 2
    1
    1 2

    Sample Output

    1 2 3
    1 2

    Author

    xhd

    Source

    HDU 2006-5 Programming Contest









    #include<iostream>   
    #include<algorithm>   
      
    using namespace std;  
      
    int main(){  
        int a[20002];  
        int n,m,i;  
        while(cin>>n>>m){  
            n+=m;  
            for(i=0;i<n;i++)  
                cin>>a[i];  
            sort(a,a+n);  
            cout<<a[0];  
            for(i=1;i<n;i++){  
                if(a[i]==a[i-1])  
                    continue;  
                else{  
                    cout<<" "<<a[i];  
                }  
            }  
            cout<<endl;  
        }  
        return 0;  
    }



  • 相关阅读:
    篝火晚会
    SECHS
    emmc4.X boot1 and boot2
    imx6Q Android7.1 Udisk Mount
    imx6Q 4.1.15 Perf support
    imx6Q 4.1.15 Kgtp support
    imx6Q 4.1.15 early console support
    imx6Q USB OTG Host/Device纯软件切换
    iMX6Q DDR Stresstest
    iMX6Q PowerSave调试
  • 原文地址:https://www.cnblogs.com/lengxia/p/4387885.html
Copyright © 2011-2022 走看看