This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

28
TangDou/XiTi/1119.cpp Normal file
View File

@@ -0,0 +1,28 @@
#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;
}