您的位置:首页 > 其它

HDU 1800 Flying to the Mars

2014-07-24 15:25 260 查看
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1800

moving table那题的同类,找相同即可

#include<stdio.h>
#include<stdlib.h>
int a[3005];
int cmp( const void *a , const void *b )
{
return *(int *)b - *(int *)a ;
}
int main()
{
int i,n,count,max;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
qsort(a,n,sizeof(a[0]),cmp);
max = count = 1;
for(i=1;i<n;i++)
{
if(a[i-1] == a[i] )
{
count++;
if(count > max)
max = count;
continue;
}
count = 1;
}
printf("%d\n",max);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: