http://acm.hdu.edu.cn/showproblem.php?pid=1338
#include <bits/stdc++.h>
using namespace std;
int N, M;
int num[55];
int main() {
int Case = 0;
while(~scanf("%d%d", &N, &M)) {
Case ++;
if(!N && !M) break;
for(int i = 1; i <= M; i ++) {
scanf("%d", &num[i]);
}
int maxx = N * M;
int cnt = 0;
sort(num + 1, num + 1 + M);
for(int i = M; i >= 1; i --) {
if(num[i] >= maxx) {
cnt ++;
maxx --;
}
else maxx -= 2;
}
printf("Case %d: %d\n", Case, cnt);
}
return 0;
}
原文:https://www.cnblogs.com/zlrrrr/p/9698782.html