华为机试:明明的随机数
#include <iostream> #include <set> using namespace std; int main() { int n, val; cin >> n; set<int> s; for (int i = 0; i < n; i++) { cin >> val; if (s.find(val) != s.end()) { continue; } else { s.insert(val); } } for (auto it = s.begin(); it != s.end(); it++) { cout << *it << endl; } return 0; }