HDU-1029-Ignatius and the Princess IV

题目链接

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

这题就是一个大水题但应注意读懂题目意思

这里不解释了

我的AC代码

#include<stdio.h>
#include<string.h>
int hash[1000000];
int main(void)
{
int n,i,a;
while(scanf("%d",&n)==1)
{
int m;
memset(hash,0,sizeof(hash));
for(i=0;i<n;i++)
{
scanf("%d",&a);
hash[a]++;
if(hash[a]>=(n+1)/2)
{
m=a;
}
}
printf("%d ",m);
}
return 0;
}

原文地址:https://www.cnblogs.com/liudehao/p/3933309.html