HDU 1029 Ignatius and the Princess IV(水题)
2016-10-26 22:53
375 查看
题意:给N个数,输出这N个数中出现至少(N+1)/2次的数.
#include<iostream> using namespace std; __int64 num[1000000];//感觉可以开得更小点。数据挺弱的 int main() { int n; while(~scanf("%d", &n)) { int k=(n+1)/2,x, ans; while(n--) { scanf("%d", &x); num[x]++; if(num[x]>=k) ans=x; } printf("%d\n", ans); } return 0; }
相关文章推荐
- HDU 1032 The 3n + 1 problem 【水题】
- HDU - 1716 排列2 水题
- HDU 1087 Super Jumping! Jumping! Jumping! DP 水题, 没能水过
- HDU - 4737 A Bit Fun 暴力水题
- hdu 2598 Manipulating the Power Square 模拟水题
- hdu 2838 树状数组水题
- hdu 3650 杭州赛水题
- hdu1520Anniversary party 树形dp水题
- HDU1290 水题
- HDU--杭电--1195--Open the Lock--深搜--忘记说句话装逼了,都是什么双向广搜,不知道怎么想的,直接就是一个深搜的水题好不好?
- HDU 5444 Elven Postman 解题报告(水题)
- HDU 1017 A Mathematical Curiosity【水题】
- 2017 Multi-University Training Contest - Team 2,HDU 6045 Is Derek lying?(思维水题)
- hdu 1209 Clock(水题)
- HDU 4493--水题+控制精度
- hdu--2191--终于可以说出dp水题这句话了-.-
- hdu 1860 统计字符 Java 水题系列
- //水题//Founding of HDU
- hdu 5563 Clarke and five-pointed star 水题
- hdu 5086 Revenge of Segment Tree(水题)