Let the Balloon Rise(水)
题目连接: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
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.
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.
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.
green
red
blue
red
red
3
pink
orange
pink
0
pink
#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(水)的更多相关文章
- hdoj-1004-Let the Balloon Rise(水题)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdu 1004 Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- 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 ...
- 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 ...
- HDU1004 Let the Balloon Rise(map的简单用法)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- HD1004Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Let the Balloon Rise(map)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- akoj-1073- Let the Balloon Rise
Let the Balloon Rise Time Limit:1000MS Memory Limit:65536K Total Submit:92 Accepted:58 Description ...
- 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 ...
随机推荐
- 每周.NET前沿技术文章摘要(2017-05-17)
汇总国外.NET社区相关文章,覆盖.NET ,ASP.NET等内容: .NET .NET Framework 4.7正式发布 链接: http://www.infoq.com/cn/news/2017 ...
- Docker容器中开始.NETCore之路
一.引言 开始写这篇博客前,已经尝试练习过好多次Docker环境安装,.Net Core环境安装了,在这里替腾讯云做一个推广,假如我们想学习.练手.net core 或是Docker却苦于没有开发环境 ...
- 解题思路:best time to buy and sell stock i && ii && iii
这三道题都是同一个背景下的变形:给定一个数组,数组里的值表示当日的股票价格,问你如何通过爱情买卖来发家致富? best time to buy and sell stock i: 最多允许买卖一次 b ...
- c#$用法
为什么会出现$符号,c#6.0才出现的新特性 var s = string.Fromat("{0}+{1}={2}",12,23,12+23) 用起来必须输入string.From ...
- Sum of AP series——AP系列之和
A series with same common difference is known as arithmetic series. The first term of series is 'a' ...
- bzoj 1996: [Hnoi2010]chorus 合唱队
Description Input Output Sample Input 4 1701 1702 1703 1704 Sample Output 8 HINT Source 因为只会在区间的两端进行 ...
- nova创建虚拟机源码分析系列之四 nova代码模拟
在前面的三篇博文中,介绍了restful和SWGI的实现.结合restful和WSGI配置就能够简单的实现nova服务模型的最简单的操作. 如下的内容是借鉴网上博文,因为写的很巧妙,将nova管理虚拟 ...
- jQueryUI Autocomplete插件使用入门教程(最新版)---------转载
前言: jQuery,无需多作介绍,相信各位读者都应该接触或使用过了.jQuery UI,简而言之,它是一个基于jQuery的前端UI框架.我们可以使用jQuery + jQuery UI非常简单方便 ...
- bat常用命令
1.@它的作用是隐藏它后面这一行的命令本身(只能影响当前行).2.echo中文为"反馈"."回显"的意思.它其实是一个开关命令,就是说它只有两种状态:打开和关闭 ...
- Hello TensorFlow 二 (GPU)
官方说明:https://www.tensorflow.org/install/ 环境: 操作系统 :Windows 10 家庭中文版 处理器 : Intel(R) Core(TM) i7-7700 ...