题解 | #明明的随机数#
明明的随机数
https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
#include <functional>
#include <iostream>
#include <unordered_map>
#include <set>
using namespace std;
int main() {
int N;
while (cin >> N) { // 注意 while 处理多个 case
set<int> st;
for (int i = 0; i < N; i++) {
int n;
cin >> n;
st.insert(n);
}
for (auto m : st) {
cout << m << endl;
}
}
}
// 64 位输出请用 printf("%lld")
使用set(底层为二叉树)可自动实现去重和排序。


