P1059 [NOIP2006 普及组] 明明的随机数

// Problem: P1059 [NOIP2006 普及组] 明明的随机数
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1059
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> info(n);
    for (int i = 0; i < n; ++i) {
        cin >> info[i];
    }
    sort(info.begin(), info.end());
    info.erase(unique(info.begin(), info.end()), info.end());
    
    cout << info.size() << endl;
    for (int i = 0; i < info.size(); ++i) {
        cout << info[i] << " ";
    }
    cout << endl;
    return 0;
}
posted @ 2022-01-28 18:36  Pannnn  阅读(51)  评论(0)    收藏  举报
-->