HJ3题解 | #明明的随机数#
明明的随机数
https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int num, n; cin >> num; std::vector<int> nums; while (num--) { cin >> n; nums.push_back(n); } sort(nums.begin(), nums.end()); // 排序 cout << nums[0] << endl; if (nums.size() == 1) { return 0; } for (int i = 1; i < nums.size(); i++) { if (nums[i] != nums[i - 1]) { cout << nums[i] << endl; } } } // 64 位输出请用 printf("%lld")#刷题#