这道题考察的是桶排序,存到数组中即可。
代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 210;
int n, m, x[N], t[N];
int main() {
ios::sync_with_stdio(false);
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> x[i];
++t[x[i]];
}
for (int i = 1; i <= n; ++i) {
--t[x[i]];
if (t[x[i]])
cout << t[x[i]] << endl;
else
cout << "BeiJu\n";
++t[x[i]];
}
return 0;
}
本人蒟蒻,欢迎各位大佬来喷。
6666