Files
python/GESP/资料/做题.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
453 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;//题单数量上限
int a[N];//每套题单里面的题的数量
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + 1 + n);
int h = 1;//排完序后,待比较的题单号
for (int i = 1;;) { //枚举每一天,依赖break停止
if (a[h] >= i) //允许,可以走到一天
i++;
if (++h > n) {
cout << i - 1 << endl;
break;
}
}
return 0;
}