题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1004

Let the Balloon Rise

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

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
5
green
red
blue
red
red
3
pink
orange
pink
0
 
Sample Output
red
pink
 
Author
WU, Jiazhi
 
Source
联系map的用法
 #include<cstdio>
#include<cstring>
#include<string>
#include<map>
#include<iostream>
using namespace std;
#define N 1010
map <string,int> mp;
struct MAX {
int a;
string color;
};
int main()
{
int n;
while(~scanf("%d",&n),n)
{
mp.clear();
for(int i = ;i < n ;i++)
{
char ss[];
scanf("%s",ss);
string s = ss;
if(mp.find(ss)==mp.end()) mp[s] = ;
else mp[s]++;
}
MAX mx;
int sum = ;
map <string , int >:: iterator it;
for( it = mp.begin(); it!=mp.end(); it++)
{
if(sum<(*it).second)
{
sum = (*it).second;
mx.a = sum;
mx.color = (*it).first;
}
}
printf("%s\n",mx.color.c_str());
}
return ;
}

Let the Balloon Rise(水)的更多相关文章

  1. hdoj-1004-Let the Balloon Rise(水题)

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

  2. hdu 1004 Let the Balloon Rise

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

  3. Let the Balloon Rise 分类: HDU 2015-06-19 19:11 7人阅读 评论(0) 收藏

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

  4. 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 ...

  5. HDU1004 Let the Balloon Rise(map的简单用法)

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

  6. HD1004Let the Balloon Rise

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

  7. Let the Balloon Rise(map)

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

  8. akoj-1073- Let the Balloon Rise

    Let the Balloon Rise Time Limit:1000MS  Memory Limit:65536K Total Submit:92 Accepted:58 Description ...

  9. HDU 1004 Let the Balloon Rise【STL<map>】

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

随机推荐

  1. 三菱Q系列PLC的io分配

    1.系统基本配置 2.存储卡配置 3.外部IO标号 4.主基板IO模块的IO号分配 5.扩展基板IO口标号 6.标准配置实例 7. 一.输入采样阶段 在输入采样阶段,可编程逻辑控制器以扫描方式依次地读 ...

  2. useradd 命令详解

    useradd 作用: 用于Linux中创建的新的系统用户, useradd 可用来建立用户账号, 账号建好之后,再用passwd 设定账号的密码, 可用userdel 删除账号. 使用useradd ...

  3. 手机端rem如何适配_rem详解及使用方法2

    作为一个前端开发人员,我们的任务是将UI设计师的图稿运用计算机语言呈现在用户面前.而现在的设备大小尺寸不一,近年来智能手机的普及更是让网页的用户大部分来源与手机,所以让不同大小的移动端屏幕都能较好的还 ...

  4. CentOS 7.x上gitlab搭建教程(https可用,邮件可用)

    目录 知识要求 搭建感想 搭建过程 参考 知识要求: nginx基础知识 搭建感想 注:以下是我搭建gitlab时的思考,需要nginx的基础知识,Docker的基础知识才容易理解,与下面的搭建过程是 ...

  5. ogg12c_静默安装

    1.上传压缩包:123010_fbo_ggs_Linux_x64_shiphome.zip 2.解压: unzip 123010_fbo_ggs_Linux_x64_shiphome.zip 3.配置 ...

  6. 访问vm中centos的web站点

    vm网络连接设置成NAT 需要把centos设置成静态IP 再不行,记得把centos的防火墙先关闭

  7. Xamarin.android 重写axml控件

    https://www.cnblogs.com/lonelyxmas/p/5632694.html <Laco: 用来用引指定的控件            android:layout_widt ...

  8. input 光标在 chrome下不兼容 解决方案

    input 光标在 chrome下不兼容 解决方案 height: 52px; line-height: normal; line-height:52px\9 .list li input[type= ...

  9. 第十三章:Python の 网络编程进阶(二)

    本課主題 SQLAlchemy - Core SQLAlchemy - ORM Paramiko 介紹和操作 上下文操作应用 初探堡垒机 SQLAlchemy - Core 连接 URL 通过 cre ...

  10. Java框架之Spring(五)

    本文主要介绍Spring中, 1 Spring JDBC 2 使用注解方式管理事务的传播行为 3 采用XML 方式配置事务 4 SH 整合 5 SSH 整合 一.Spring JDBC 1) 导包 , ...