HDU OJ 1004 Let the Balloon Rise
来源:互联网 发布:urp 数据库 编辑:程序博客网 时间:2024/06/05 19:38
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 126760 Accepted Submission(s): 50105
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: 1008 1005 1009 1019 1021
code:
#include <iostream>#include <map>#include <cstring>#include <string>using namespace std;const int maxn=1e3+5;string str[maxn];int main() {int N;map<string,int> maps;while(cin>>N){if(N==0) return 0;maps.clear();for (int i=0;i<N;i++) {cin>>str[i];maps[str[i]]++;}map<string,int>::iterator it;int max=0;string maxcolor;for (it=maps.begin();it!=maps.end();++it) {if (it->second>max) {max=it->second;maxcolor=it->first;}}cout<<maxcolor<<endl;}return 0;}
Submit
阅读全文
0 0
- hdu-oj 1004 Let the Balloon Rise
- Hdu oj 1004 Let the Balloon Rise
- HDU OJ 1004 Let the Balloon Rise
- Hdu oj 1004 Let the Balloon Rise(map)
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- Hdu 1004 - Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- java中double类型相加出现的怪事
- 【JavaWeb】前台参数传入后台解密(decode)
- Hibernate懒加载、关联级别加载策略
- phpcmsv9 补丁
- java 服务端验证苹果支付applepay账单
- HDU OJ 1004 Let the Balloon Rise
- React写法和演进
- 计算机网络--计算机网络体系结构(1)
- Ubuntu14.04+opencv2.4.9+codeblocks13.12(或codeblocks16.01)安装使用及配置
- C++ 算法(<algorithm>)的谓词(predicate)详解
- JSONP跨域请求数据报错 “Unexpected token -”的解决办法
- 爆款论文提出简单循环单元SRU:像CNN一样快速训练RNN(附开源代码)
- 使用truffle与以太坊平台进行交互
- Spring-AOP @AspectJ进阶之绑定连接点方法入参