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. VPS centos 6 安装图形界面

    在某种场合之下,我们使用的Linux还是要选择安装桌面环境的,所以在这里介绍一下如何给没有安装桌面环境的系统安装桌面环境.以Centos 6.5 为例演示一下如何安装桌面环境. 工具/原料 Linux ...

  2. VLC 重新编译第三方库的预编译包contrib

    VLC的引用了很多开源的第三方库,均放到VLC目录下的contrib中(本来开始编译是2.1.x以上版本,以前或以后可能会变化),在Windows版本编译中,contrib文件夹中仅仅下载VLC官网上 ...

  3. div+css的优势在哪?

    1.符合W3C标准.微软等公司都是他的支持者. 2.所搜引擎更加友好. 3.样式调整更加方便. 4.css简洁的代码,减少了带宽. 5.表现和结构分离.在团队开发中更容易分工 并不是取代table,t ...

  4. UCOS2_STM32F1移植详细过程(四)

    Ⅰ.概述 上一篇文章是讲述uC/OS-II Ports下面os_cpu_a.asm.os_cpu_c.c和os_cpu.h文件底层端口代码的移植(修改)和说明,接着上一篇文章来讲述关于UCOS移植应用 ...

  5. USB总线介绍

    •USB 1.0出现在1996年的,速度只有1.5Mb/s1998年升级为USB 1.1,速度也提升到12Mb/s,称之为”full speed” •USB2.0规范是由USB1.1规范演变而来的.它 ...

  6. JSAPI_Ticket签名

    1.微信 JS 接口签名校验工具 2.具体开发 2.1 获取access_token,然后jsapi_ticket /** * 获取access_token,然后jsapi_ticket */ pri ...

  7. 详谈 oracle 索引 (笔记)

    1.oracle索引空值问题 当在有空值得列上建立单列索引时,如果搜索条件为 is null 在解释计划中可以看到,对于此列oracle并没有使用索引查询: 但是当建立的是多列索引是,就会按照索引来进 ...

  8. 在JAVA中使用JSONObject生成json

    JSON是一种轻量级的数据交换格式,在现在的web开发中,是非常常见的.在没有方便的工具之前,我们或许会使用拼字符串的形式来生成json数组,今天我们使用一个json-lib.jar包来为我们实现生成 ...

  9. 教你怎么安装MongoDB

    以下命令以root用户运行:#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10#echo 'deb http://do ...

  10. 嵌入式web服务

    :boa.thttpd.mini_httpd.shttpd.lighttpd.goaheand.appweb和apache等. Boa 1.介绍 Boa诞生于1991年,作者Paul Philips. ...