hdu 1029 Ignatius and the Princess IV
2012-12-18 12:09
495 查看
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1029
题目主要意思是:有奇数个数,这些数只由两个数据组成,求其中最多个数的数据,输出即可!
题目主要意思是:有奇数个数,这些数只由两个数据组成,求其中最多个数的数据,输出即可!
#include<iostream> #include<cstdio> using namespace std; int main() { int n,i; int number; //用来标记目前最多数的数据 int t; //输入的数据 int count; //用来计数 while(scanf("%d",&n)!=EOF) { count = 0; if(n%2 == 0) break; for(i = 0; i < n; i++) { scanf("%d",&t); if(count == 0) { count = 1; number = t; } else { if(t == number) count++; else count--; } } printf("%d\n",number); } return 0; }
相关文章推荐
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV(快排)
- HDU 1029 Ignatius and the Princess IV (DP,水题)
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 - Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV(水题)
- HDU 1029 Ignatius and the Princess IV
- 【HDU 1029】Ignatius and the Princess IV (动态规划)
- HDOJ HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV(动规水题,有个很精妙的快解法)
- hdu 1029 Ignatius and the Princess IV
- hdu1029——Ignatius and the Princess IV
- [ACM] hdu 1029 Ignatius and the Princess IV (动归或hash)
- hdu 1029 Ignatius and the Princess IV(水题)
- HDU 1029 Ignatius and the Princess IV
- HDU--1029--Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- 【hdu 1029】Ignatius and the Princess IV
- B - Ignatius and the Princess IV HDU - 1029 暴力求解