我原本挂了个hash专场,不知在哪里看的,把这个题也挂上去了
毛线hash,大水题好吧......
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#define LL long long
using namespace std;
const LL maxn = 3000 + 30 ;
LL arr[maxn];
int main(){
LL n,ma,ans;
while(~scanf("%lld",&n)&&n){
ma=0;
for(LL i=0;i<n;i++){
scanf("%lld",&arr[i]);
// cout<<arr[i]<<endl;
}
sort(arr,arr+n);
ans=0;
for(LL i=1;i<n;i++){
if(arr[i]==arr[i-1]){ans++;if(i==n-1)ma=max(ans+1,ma);}//cout<<"yunxing"<<endl;
else {
ma=max(ma,ans+1);
ans=0;
}
}
if(ma==0)printf("1\n");
else printf("%lld\n",ma);
}
return 0;
}