hdoj 1004 Let the Balloon Rise
来源:互联网 发布:杭州整站优化公司 编辑:程序博客网 时间:2024/06/16 13:33
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 125027 Accepted Submission(s): 49351
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#include<map>#include<string>#include<iostream>using namespace std;int main(){ int n; map<string,int>mp; string s; while(cin>>n&&n) { while(n--) { cin>>s; if(!mp.count(s)) mp[s]==0; mp[s]++; } int max=0; string ans; map<string,int>::iterator it; for(it=mp.begin();it !=mp.end();++it) { if(mp[it->first]>max) { max=mp[it->first]; ans=it->first; } }cout<<ans<<endl; mp.clear(); } return 0;}
阅读全文
0 0
- HDOJ 1004 Let the Balloon Rise (map)
- HDOJ-1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- hdoj 1004 Let the Balloon Rise
- hdoj.1004 Let the Balloon Rise 20140726
- HDOJ Let the Balloon Rise 1004
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise(水题)
- 【HDOJ】【1004】Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDoj 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- hdoj 1004 Let the Balloon Rise (map)
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- 啊哈磊的挑战,前几个比较简单的题。
- dependencies与dependencyManagement的区(转自:http://blog.csdn.net/liutengteng130/article/details/46991829)
- 用类加载器实现Java插件式开发
- 彻底解决 LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- leetcode(55). Jump Game
- hdoj 1004 Let the Balloon Rise
- HDU
- jquery操作数组
- 论文类型Journal、magazin、transaction、letter等的区别
- oracle中的约束操作
- Hook小笔记
- 设计模式 _备忘录模式
- JAVA设计模式之单例模式
- 算法题练习系列之(二十一): 人口普查