HDU1004——Let the Balloon Rise
This year, they decide to leave this lovely job to you.
A test case with N = 0 terminates the input and this test case is not to be processed.
green
red
blue
red
red
3
pink
orange
pink
0
pink
分析:map第二弹~
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
using namespace std;
int main()
{
int n;
string color,s;
map<string,int>Balloon;
while(scanf("%d",&n)&&(n!=0))
{
Balloon.clear();
for(int i=0;i<n;i++)
{
cin>>color;
Balloon[color]++;
}
int max=-1;
map<string,int>::iterator p;
for(p=Balloon.begin();p!=Balloon.end();p++)
{
if((*p).second>max)
{
max=(*p).second;
s=(*p).first;
}
}
cout<<s<<endl;
}
return 0;
}
HDU1004——Let the Balloon Rise的更多相关文章
- HDU1004 Let the Balloon Rise(map的简单用法)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- [HDU1004] Let the balloon rise - 让气球升起来
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- hdu1004 Let the Balloon Rise
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- 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 ...
- 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 ...
随机推荐
- 【BZOJ 2839】 2839: 集合计数 (容斥原理)
2839: 集合计数 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 399 Solved: 217 Description 一个有N个元素的集合有2 ...
- 27.prim算法 最优布线问题(wire.cpp)
[例4-10].最优布线问题(wire.cpp) [问题描述] 学校有n台计算机,为了方便数据传输,现要将它们用数据线连接起来.两台计算机被连接是指它们间有数据线连接.由于计算机所处的位置不同,因此不 ...
- redis配置参数简介
redis配置查看方式: 1.redis的安装目录查看redis.conf 2.登陆redis客户端,使用 config get xx命令. 比如:查看所有的配置: config get * [roo ...
- textbox约束输入值问题解答
网上很多关于文本框只能输入数字的,今天又找了一遍,发现以前的写法居然有点问题! onkeypress="if (event.keyCode<48 || event.keyCode> ...
- VS2012项目中使用CocoStudio相关文件的设置
开发环境说明: win7 vs2012 coco2d-x 3.0 alpha1 cocos2d-x 3.0 alpha 1搭配CocoStudio使用,效果更佳.CocoStudio包含了游戏开发 ...
- Digital Current-Mode Control Challenges Analog Counterparts
http://electronicdesign.com/digital-ics/digital-current-mode-control-challenges-analog-counterparts ...
- ubuntu 包管理详解
http://www.cnblogs.com/forward/archive/2012/01/10/2318483.html
- arcengine帮助http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/what_s_new_for_developers_at_10_/0001000002zp000000/
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/what_s_new_for_develope ...
- FIS常用命令
命令 用途 简写 fis --version 查看版本 fis -v fis install 安装 fis release 发布项目 fis server start 启动一个服务器用于预览项 ...
- MFC 获取DC和输出文字、获取指定区域
缓存DC的作用:解决闪烁问题 CRect rect; GetClientRect(rect);获取view视图的区域 CClientDC dc(this); 创建了DC可作图 pdc->Dra ...