Files
python/TangDou/XiTi/1119.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

29 lines
580 B
C++

#include <bits/stdc++.h>
using namespace std;
//map排序(key)的比较器
struct cmpFunction {
bool operator()(const int &k1, const int &k2) const {
return k1 < k2;
}
};
int main() {
int n;
cin >> n;
map<int, int, cmpFunction> _map;
for (int i = 0; i < n; ++i) {
int c;
cin >> c;
_map[c]++;
}
//输出结果
cout << _map.size() << endl;
for (map<int, int>::iterator iter = _map.begin(); iter != _map.end(); ++iter) {
cout << iter->first << " ";
}
return 0;
}