杭电ACM 1004 Let the Balloon Rise
来源:互联网 发布:用什么软件下载电视剧 编辑:程序博客网 时间:2024/06/15 08:40
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 89812 Accepted Submission(s): 34060
Problem Description
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.
This year, they decide to leave this lovely job to you.
This year, they decide to leave this lovely job to you.
Input
Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.
A test case with N = 0 terminates the input and this test case is not to be processed.
A test case with N = 0 terminates the input and this test case is not to be processed.
Output
For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.
Sample Input
5greenredblueredred3pinkorangepink0
Sample Output
redpink使用STL库中的map做代码如下:#include <iostream>#include <map>#include <string>using namespace std;int main(){map<string,int> m;string a,b;int n,max;while(cin>>n,n){max=-1;while(n--){cin>>a;m[a]++;if(m[a]>max){max=m[a];b=a;}}cout<<b<<endl;}return 0;}
0 0
- Let the Balloon Rise(杭电ACM 1004)
- 杭电acm 1004 (Let the Balloon Rise)
- 杭电ACM 1004 “+Let+the+Balloon+Rise”
- 杭电ACM-1004 Let the Balloon Rise
- 杭电acm 1004 Let the Balloon Rise
- 杭电ACM----------1004 Let the Balloon Rise
- 杭电ACM 1004 Let the Balloon Rise
- 杭电ACM—1004 Let the Balloon Rise
- 杭电ACM(1004) Let The Balloon Rise
- 杭电ACM 1004 Let the Balloon Rise
- 杭电 1004[Let the Balloon Rise]
- 杭电 1004 Let the Balloon Rise
- 杭电 1004 Let the Balloon Rise
- 杭电 1004 Let the Balloon Rise
- 杭电1004 Let the Balloon Rise
- 杭电-1004 Let the Balloon Rise
- 杭电1004---Let the Balloon Rise
- 杭电1004-Let the Balloon Rise
- 认识 Cocos2dx 3.x
- 暑假-动态规划 III-(Q - Alignment)
- 项目管理模式之如何去除SVN标记
- 卡特兰数-Catalan数
- collections
- 杭电ACM 1004 Let the Balloon Rise
- 详解二级指针
- 求连续子串的最大数问题
- 借教室续
- java webservice简单实现
- Remove Duplicates from Sorted Array
- 20150802-BufferedReader和BufferedWriter
- c#委托
- HashSet