Let the Balloon Rise

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) 
Total Submission(s): 106421 Accepted Submission(s): 41214

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.

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.

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 

green 
red 
blue 
red 
red 

pink 
orange 
pink 
0

Sample Output 
red 
pink

Author 
WU, Jiazhi

Source 
ZJCPC2004

Recommend 
JGShining
关于map的一些用法: 
http://www.cnblogs.com/BeyondAnyTime/archive/2012/08/24/2654353.html

 #include<bits/stdc++.h>
using namespace std;
int main(){
int t,max;
string s,ms;
map<string,int> p;
while(cin>>t&&t!=){
p.clear();
for(int i=;i<t;i++){
cin>>s;
p[s]++;//
}
max=;
map<string,int>::iterator i;
for(i=p.begin();i!=p.end();i++){
if(max<i->second){
ms=i->first;
max=i->second;
}
}
cout<<ms<<endl;
}
}

HDU1004 Let the Balloon Rise(map的简单用法)的更多相关文章

  1. HDU 1004 Let the Balloon Rise map

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  2. Let the Balloon Rise(map)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  3. [HDU1004] Let the balloon rise - 让气球升起来

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  4. Let the Balloon Rise <map>的应用

    Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...

  5. HDU 1004 Let the Balloon Rise(map应用)

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  6. Let the Balloon Rise map一个数组

    Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...

  7. HDU1004——Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  8. hdu1004 Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  9. hdoj-1004-Let the Balloon Rise(map排序)

    map按照value排序 #include <iostream> #include <algorithm> #include <cstring> #include ...

随机推荐

  1. How to setup and process Intercompany accounting [AX2012]

    In this post, I will take you through a very simple functionality called  the intercompany accountin ...

  2. C# 平时碰见的问题【5】

    vs按F5启动调试,项目不会编译的解决办法 工具 -> 选项 -> 项目和解决方案 -> 运行时, 当项目过期(下拉框) -> 不要选[从不生成] 附英文版的:

  3. TTY驱动程序架构

    在Linux系统中,终端是一类字符型设备,它包括多种类型,通常使用tty来简称各种类型的终端设备. • 串口终端(/dev/ttyS*) 串口终端是使用计算机串口连接的终端设备.Linux把每个串行端 ...

  4. esp和ebp详解

    最近在研究栈帧的结构,但总是有点乱,所以写了一个小程序来看看esp和ebp在栈帧中的作用.这个程序如下: 这个程序很简单,就是求两个数的值,然后输出即可.所以首先把它用gcc编译链接成a.out,进入 ...

  5. hdu 1316 How Many Fibs?

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1316 How Many Fibs? Description Recall the definition ...

  6. zoj 2112 Dynamic Rankings

    原题链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1112 #include<cstdio> #include ...

  7. IOS应用程序升级

    IOS应用程序升级流程介绍:IOS手机端应用程序需要升级时,打开服务器端html文件(本文为ucab.html文件)->点击在线安装->打开plist文件(本文中为ucab.plist文件 ...

  8. 如何向VS2010中插入ActiveX控件并且附带相应的类

    上两篇文章中我们已经讲述了ActiveX控件的一些相关知识,本文中,简单说明一下如何在我们自己的程序中使用ActiveX控件.(仍以我们上节课的例子为例) 我们打开VS2010编辑器,新建一个基于对话 ...

  9. P1119: [POI2009]SLO

    这题预处理稍微动动脑,其实还是个裸的置换群=-=,没什么压力. ; var n,i,j,minx,tem,now,tmin,len:longint; cursum,sum:int64; pos,num ...

  10. Oracle 11g 11201_RHEL5.5_RAC_VBOX 详细搭建步骤

    1.安装好vbox,创建好虚拟机(红帽5.5),注意:VBOX全局设置VBOX磁盘的位置和备份位置     IP.hostname 规划:              hostname          ...