75 #2WA
查看原帖
75 #2WA
1032499
jintingze123楼主2024/6/29 16:32
#include<bits/stdc++.h>
using namespace std;
int a[1000005],n ;
int main() {
    cin >> n ;
    for(int i = 1 ; i <= n ; i++)cin >> a[i] ;
    sort(a+1,a+n+1) ;
    long long tot=1,s=1 ;//tot:目前遍历下标,s:目前所需题目数量
    while(tot!=n){
        if(a[tot]>=s)s++ ;
        tot++ ;
    }
    cout << s-- ;
    return 0;
}
2024/6/29 16:32
加载中...