Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
113966 | 石茂诤 | 明明的随机数 | C++ | Accepted | 1 MS | 276 KB | 377 | 2025-03-18 13:25:07 |
#include <iostream> using namespace std; int main() { int n, tmp, ans = 0; int cnt[1001] = {}; cin >> n; while (n--) { cin >> tmp; cnt[tmp]++; if (cnt[tmp] == 1) ans++; } cout << ans << endl; int i = 1; while (cnt[i] == 0) i++; cout << i; for (i = i + 1; i < 1001; i++) if (cnt[i] > 0) cout << " " << i; cout << endl; return 0; }