【NOIP2006】【codevs1075】明明的随机数

problem

solution

codes

#include<iostream>
using namespace std;
int n, a[1010], t;
int main(){
    cin>>n;
    for(int i = 1; i <= n; i++){
        int x;  cin>>x;
        if(!a[x]){ a[x]++; t++; }
    }
    cout<<t<<"
";
    for(int i = 1; i <= 1000; i++)
        if(a[i])cout<<i<<" ";
    return 0;
}
原文地址:https://www.cnblogs.com/gwj1314/p/9444744.html