题解 | #Simple Sorting#
Simple Sorting
http://www.nowcoder.com/practice/139761e0b59a405786898b7f2db9423f
#include<iostream> #include<unordered_set> #include<algorithm> #include<vector> using namespace std; int main() { int n; unordered_set<int> numset; vector<int> result; int num; cin >> n; for (int i = 0; i < n; ++i) { cin >> num; numset.insert(num); } for (auto tmp : numset) result.push_back(tmp); sort(result.begin(), result.end()); for (int i = 0; i < result.size(); ++i) cout << result[i] << " "; cout << endl; return 0; }