题解 | #明明的随机数#
明明的随机数
https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
#include <algorithm> #include <iostream> #include <unordered_set> #include <vector> using namespace std; int main() { int n; cin >> n; int nums[n]; unordered_set<int> numOnly; for(int& num : nums) { cin >> num; numOnly.insert(num); } vector<int> ans(numOnly.begin(),numOnly.end()); sort(ans.begin(),ans.end()); for(int& num : ans) { cout << num << endl; } return 0; }