提交时间:2026-05-26 16:42:39

运行 ID: 441979

#include <iostream> using namespace std; int cnt[1005]; // 项目编号最大999 int main() { ios::sync_with_stdio(false); // 加速输入输出 cin.tie(0); int n, m; cin >> n >> m; // 统计每个编号出现次数 for (int i = 0; i < m; i++) { int x; cin >> x; cnt[x]++; } // 从小到大输出 for (int i = 1; i <= n; i++) { while (cnt[i]--) { cout << i << " "; } } return 0; }