#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<int> st; while(n --) { int x; cin >> x; st.insert(x); } for(auto x : st) cout << x << '\n'; } // 64 位输出请用 printf("%lld")
总结题目要求, 去重排序, 可以直接使用c++STL的set来统计即可。
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<int> st; while(n --) { int x; cin >> x; st.insert(x); } for(auto x : st) cout << x << '\n'; } // 64 位输出请用 printf("%lld")
总结题目要求, 去重排序, 可以直接使用c++STL的set来统计即可。