HDU 1800 Flying to the Mars

来源:互联网 发布:java 代理模式详解 编辑:程序博客网 时间:2024/06/07 06:37

题目: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;}


0 0
原创粉丝点击