P1271 【深基9.例1】选举学生会

题目传送门
//P1271.cpp

#include <bits/stdc++.h>

using namespace std;
const int N = 1010;
int a[N];
int n, m, tmp;

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> tmp;
        a[tmp]++;
    }
    for (int i = 1; i <= n; i++)        //号
        for (int j = 0; j < a[i]; j++) //次数
            cout << i << ' ';
    return 0;
}
posted @ 2021-11-23 13:46  糖豆爸爸  阅读(58)  评论(0编辑  收藏  举报
Live2D