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 ...
随机推荐
- Ant学习笔记
前言:这段时间在学习Ant,发现这是一个很强大的构建工具.你可能使用了很长一段时间,才发现Ant能做数不完的事.总之,个人觉得,Ant学习门槛低,入门简单,能大概看懂程序,写一些简单的脚本即可,剩下在 ...
- 公牛与状压dp
T1 疾病管理 裸得不能再裸的状压dp 不过数据范围骗人 考试时k==0的点没过 我也很无奈呀qwq #include<iostream> #include<cstdio> # ...
- RabbitMQ之消费者Demo(队列参数详细说明)
package com.jiefupay; import java.io.IOException; import java.util.HashMap; import java.util.Map; 8 ...
- <tangmuchw>之新手vue项目小记--新建.vue文件,运行项目,出现error:This dependency was not found...
错误码: This dependency was not found: * !!vue-style-loader!css-loader?{"minimize":false,&quo ...
- Docker(一):Docker安装
简介:Docker是一个开源的引擎,可以轻松的为任何应用创建一个轻量级的.可移植的.自给自足的容器.开发者在笔记本上编译测试通过的容器可以批量地在生产环境中部署,包括VMs(虚拟机).bare met ...
- rm 命令详解
rm 作用: 删除一个目录中的一个或多个文件或目录,也可以将某个目录及下属的所有文件及子目录均删除掉, 对于连接文件只是删除整个连接文件,而保持原有文件. 注意: 使用rm 命令要格外小心,因为一旦 ...
- Python列表list对象方法总结
- Amazon email system中使用的字体
- JDK8中JVM对类的初始化探讨
在<深入理解Java虚拟机>(第二版,周志明著)中,作者介绍了JVM必须初始化类(或接口)的五种情况,但是是针对JDK7而言的. 那么,在JDK8中,这几种情况有没有变化呢?(我猜测应该会 ...
- Io 异常: The Network Adapter could not establish the connection
新接触一个项目,导入源码,在本地启动的时候后台报了一个错误: Could not discover the dialect to use. java.sql.SQLException: Io 异常: ...