C++ 中好用的STL --- set
#include<iostream> #include<algorithm> #include<set> using namespace std; int main() { set<int> a; int n; cin >> n; for(int i=0;i<n;i++) { int x; cin >> x; a.insert(x); } for (auto x: a) cout << x << " "; return 0; }
C++ 中好用的STL --- set
#include<iostream> #include<algorithm> #include<set> using namespace std; int main() { set<int> a; int n; cin >> n; for(int i=0;i<n;i++) { int x; cin >> x; a.insert(x); } for (auto x: a) cout << x << " "; return 0; }