0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 07:51:58 +00:00

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

R65563173
This commit is contained in:
Baoshuo Ren 2021-12-22 16:25:45 +08:00
parent ddcae8fcca
commit 4e64606164
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

26
Luogu/P1059/P1059.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <algorithm>
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
int n, x;
std::vector<int> a;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
a.push_back(x);
}
std::sort(a.begin(), a.end());
a.erase(std::unique(a.begin(), a.end()), a.end());
cout << a.size() << endl;
for (int i : a) {
cout << i << ' ';
}
cout << endl;
return 0;
}