您的位置:首页 > 其它

hdu - 1029 -Ignatius and the Princess IV

2014-12-27 20:14 302 查看
今天写题目突然想起来这个小技巧,哈哈哈哈呵呵,忘记是哪一题狂找找出来了。。。

#include<stdio.h>
int main()
{
long n,num,cnt,res;
while(~scanf("%d",&n))
{
cnt = 0;
while(n--)
{
scanf("%d",&num);
if(0 == cnt)
{
res = num;
cnt++;
}
else
{
if(res == num)
cnt++;
else
cnt--;
}
}
printf("%d\n",res);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: