mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
29 lines
577 B
C++
29 lines
577 B
C++
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
#include<algorithm>
|
||
|
using namespace std;
|
||
|
int a[100],n;
|
||
|
int main(){
|
||
|
while(scanf("%d",&n)!=EOF){
|
||
|
memset(a,0,sizeof(a));
|
||
|
for(int i=1;i<=n;i++){
|
||
|
scanf("%d",&a[i]);
|
||
|
}
|
||
|
sort(a,a+n+1);
|
||
|
int k=1;
|
||
|
int fro=a[1];
|
||
|
int site=1;
|
||
|
int left=0;
|
||
|
for(int i=2;i<=n;i++){
|
||
|
if(a[i]>fro&&i-site+left>=k+1&&a[i]!=a[i-1]){
|
||
|
fro=a[i];
|
||
|
left=i-site-k-1+left;
|
||
|
site=i;
|
||
|
k++;
|
||
|
}else continue;
|
||
|
}
|
||
|
printf("%d\n",k);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|