http://acm.hdu.edu.cn/showproblem.php?pid=1800

4 10 20 30 04 5 2 3 4 3 4
1 2

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[3002];
bool cmp(int a,int b)
{
return a>b;
}
int main()
{
int n,i,j,tot,k;
while(~scanf("%d",&n))
{
k=1;
tot=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n,cmp);
for(i=1;i<n;i++)
{
if(a[i]==a[i-1])
k++;
else
{
if(tot<k)
{
tot=k;
}
k=1;
}
}
if(k>tot)
tot=k;
printf("%d\n",tot);
}
return 0;
}
杭电 1800 Flying to the Mars(贪心),布布扣,bubuko.com
杭电 1800 Flying to the Mars(贪心)
原文地址:http://blog.csdn.net/u012766950/article/details/38333935