HDUOJ Let the Balloon Rise
来源:互联网 发布:英雄美工钢笔9076 编辑:程序博客网 时间:2024/06/07 15:08
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 125039 Accepted Submission(s): 49360
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
Author
WU, Jiazhi
Source
ZJCPC2004
Recommend
JGShining | We have carefully selected several similar problems for you: 1002 1001 1008 1005 1003
#include <iostream>#include <map>#include <string>using namespace std;map<string, int> mp;int main(){ int n; while (cin>>n, n!=0) { string s,p; int mx=0; for (int i=0;i<n;i++) { cin>>s; if (mp.find(s)==mp.end()) { mp[s]=1; if (1>mx) { mx=1; p=s; } } else { mp[s]++; if (mp[s]>mx) { mx=mp[s]; p=s; } } } cout << p << endl; }}
阅读全文
1 0
- HDUOJ Let the Balloon Rise
- HDUOJ Let the Balloon Rise 1004
- HDUOJ 1004 - Let the Balloon Rise
- HDUoj- 1004 -Let the Balloon Rise ( map
- [HDUOJ] 1004 Let the Balloon Rise
- HDUOJ 1004 Let the Balloon Rise(map容器)
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- 手摸手教你搭建vue-cli脚手架-详细步骤图文解析[vue入门]
- Java内部类的概念
- Arbitrage
- 【c#】C#调用matlab动态链接库
- 2017多校4 1011 Time To Get Up
- HDUOJ Let the Balloon Rise
- 解决浏览器会产生缓存的问题
- POJ 2513 Colored Sticks 好题 字典树+并查集+欧拉路
- 线程分组 | 守护线程 | 线程优先级
- Arrays静态方法
- SDPhotoBrowser 详细介绍 非常简单易用的图片浏览器,模仿微博图片有源码例子
- C++实现俄罗斯方块源码分享(Windows编程),有图形界面
- linux 中IO多路复用epoll函数的ET和LT工作模式详解
- 会场预约