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 ...
随机推荐
- 表白 代码 韩梦飞沙-画心.html
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 韩梦飞沙-画心.html <!DOCTYPE html> <html& ...
- FFTW3学习笔记2:FFTW(快速傅里叶变换)中文参考
据说FFTW(Fastest Fourier Transform in the West)是世界上最快的FFT.为了详细了解FFTW以及为编程方便,特将用户手册看了一下,并结合手册制作了以下FFTW中 ...
- [BZOJ3583]杰杰的女性朋友(矩阵快速幂)
杰杰的女性朋友 时间限制:10s 空间限制:256MB 题目描述 杰杰是魔法界的一名传奇人物.他对魔法具有深刻的洞察力,惊人的领悟力,以及令人叹为观止的创造力.自从他从事魔法竞赛以来,短短几 ...
- 【二分图最大匹配】【匈牙利算法】zoj3988 Prime Set
题意:给你n个正整数,一对和为素数的数为一个合法数对.你选不超过K个合法数对,使得你选的数对涉及到的数的数量最大化.输出这个值. 所有1之间是可以任意两两配对的. 把奇数放在左侧,偶数放在右侧. 考虑 ...
- 三、python的数据类型 列表、元组、字典
1.list 列表 列表是由一序列特定顺序排列的元素组成的.可以把字符串,数字,字典等都可以任何东西加入到列表中,列表中的元素之间没有任何关系.列表也是自带下标的,默认也还是从0开始. List常用的 ...
- JS 判断PC、android、ios、微信浏览器
1.通过js userAgent来判断 <h1>判断访问此链接的操作系统</h1> <script> var Agents = new Array("An ...
- Mahout学习之Mahout简单介绍、安装、配置、入门程序測试
一.Mahout简单介绍 查了Mahout的中文意思--驭象的人,再看看Mahout的logo,好吧,想和小黄象happy地玩耍,得顺便陪陪这位驭象人耍耍了... 附logo: (就是他,骑在象头上的 ...
- Control an LM317T with a PWM signal
http://www.edn.com/design/analog/4363990/Control-an-LM317T-with-a-PWM-signal The LM317T from Nationa ...
- MAC 更新SVN到1.8
经过谷歌和百度N次后,最终搞定SVN的升级,Intellij Idea和Xcode5.1都能够正常使用. 步骤: 1. 下载Subverion的Max安装版.(推荐.使用其它brew和port都试过, ...
- Socket INADDR_ANY详解
转载:http://hi.baidu.com/zorro_knight/item/37af9e8c9dc71253e73d1924 linux下的socket INADDR_ANY表示的是一个服务器上 ...