题解
2023-08-26 09:26:59
发布于:广东
0阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4+10;
int a[maxn];
int b[maxn], n, sum;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
int y;
cin >> y;
a[y]++;
b[i] = y;
}
sort(b, b + n + 1);
for (int i = 1; i <= b[n]; i++) {
if (a[i] != 0)
sum++;
}
cout << sum << endl;
for (int i = 1; i <= b[n]; i++) {
if (a[i] != 0)
cout << i << " ";
}
return 0;
}
这里空空如也
有帮助,赞一个