Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2418 Accepted Submission(s):
1088
#include <algorithm> #include <cstdio> using namespace std; int maxn,ans,t,n,buil[10005]; int main() { scanf("%d",&t); for(;t--;) { maxn=ans=1; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&buil[i]); sort(buil+1,buil+1+n); for(int i=2;i<=n;i++) { if(buil[i]==buil[i-1]) ans++; else { if(ans>maxn) maxn=ans; ans=1; } } if(ans>maxn) maxn=ans; printf("%d\n",maxn); } return 0; }
原文:http://www.cnblogs.com/ruojisun/p/7203113.html