生活随笔
收集整理的這篇文章主要介紹了
hdu 1800
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我原本掛了個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;
}
總結
以上是生活随笔為你收集整理的hdu 1800的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。