首页 > 其他 > 详细

HDU-1029-Ignatius and the Princess IV

时间:2014-08-24 20:41:03      阅读:359      评论:0      收藏:0      [点我收藏+]

题目链接

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\n",m);
}
return 0;
}

HDU-1029-Ignatius and the Princess IV

原文:http://www.cnblogs.com/liudehao/p/3933309.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!