WA#2
代码如下
#include<bits/stdc++.h>
using namespace std;
int main(){
int T,ans=0;
cin>>T;
deque<int> d;
while(T--){
int n;
cin>>n;
d.push_back(n);
}
sort(d.begin(),d.end());
for(ans=1;;ans++){
if(d.empty()){
break;
}
for(int s=0;s!=1;){
if(d[0]>=ans){
s++;
}
d.pop_front();
if(d.empty()){
break;
}
}
}
cout<<ans-1;
return 0;
}