题解 | #明明的随机数#
明明的随机数
https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
#include <iostream> #include <map> using namespace std; #define x first #define y second int main() { int n; cin >> n; map<int, int> mp; //利用map直接自动去重加上排序,一步到位 for(int i = 0; i < n; i ++) { int x; cin >> x; mp[x] = 1; } for(auto t : mp) cout << t.x << endl; return 0; }