Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K (Java/Others)Total Submission(s): 43629    Accepted Submission(s): 19213 Problem Description "OK, you are not too bad, em... But you can never pass the…
<题目链接> 题目大意:给你一段序列,问你在这个序列中出现次数至少为 (n+1)/2 的数是哪个. 解题分析: 本题是一道水题,如果用map来做的话,就非常简单,但是另一个做法还比较巧妙. 解法一: #include <cstdio> int main() { int n,t,cnt,result; while(scanf("%d",&n)!=EOF){ cnt=; ;i<n;i++){ scanf("%d",&t);…
HDU 1029 题目大意:给定数字n(n <= 999999 且n为奇数 )以及n个数,找出至少出现(n+1)/2次的数 解题思路:n个数遍历过去,可以用一个map(也可以用数组)记录每个数出现的次数, 若次数一旦达到(n+1)/2,即输出a[i] 注意能出现(n+1)/2次数的最多只有一个 /* HDU 1029 *Ignatius and the Princess IV --- dp */ #include <cstdio> #include <cstring> #in…
Treats for the Cows Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7949   Accepted: 4217 Description FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per da…
Help Jimmy Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14214   Accepted: 4729 Description "Help Jimmy" 是在下图所示的场景上完成的游戏. 场景中包括多个长度和高度各不相同的平台.地面是最低的平台,高度为零,长度无限. Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒.当Jimmy落到某个平台上时,游戏者选择让它向左还是向右…
免费馅饼 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 64198    Accepted Submission(s): 22545 Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的1…
Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12174    Accepted Submission(s): 5868 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a l…
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14253    Accepted Submission(s): 6035 Problem Description FatMouse has stored some cheese in a city. The city can be considere…
Tickets Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8077    Accepted Submission(s): 4101 Problem Description Jesus, what a great movie! Thousands of people are rushing to the cinema. However…
Piggy-Bank Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35043    Accepted Submission(s): 17420 Problem Description Before ACM can do anything, a budget must be prepared and the necessary fina…