Let the Balloon Rise map一个数组
This year, they decide to leave this lovely job to you.
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.
OutputFor 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 代码:
#include <iostream>
#include <cstdio>
#include <queue>
#include <map>
using namespace std; int main()
{
int n;
string a,max="a";
map<string,int> b;
while(scanf("%d",&n)&&n)
{
b[max]=;
for(int i=;i<=n;i++)
{
cin>>a;
b[a]++;
if(b[a]>b[max])max=a;
}
cout<<max<<endl;
}
}
Let the Balloon Rise map一个数组的更多相关文章
- 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 ...
- Let the Balloon Rise(map)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- Let the Balloon Rise <map>的应用
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...
- HDU 1004 Let the Balloon Rise(map应用)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- hdoj-1004-Let the Balloon Rise(map排序)
map按照value排序 #include <iostream> #include <algorithm> #include <cstring> #include ...
- 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 ...
- HDU1004 Let the Balloon Rise(map的简单用法)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- hdu 1004 Let the Balloon Rise strcmp、map、trie树
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的使用)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...
随机推荐
- PHP算法之排序算法(PHP内置排序函数)
首先用实例来讲述一下PHP内置的一些排序函数 [a / k] sort [/ rsort]:[保留索引关系 / 按键名(保留键名关系,适用于关联数组)] 对数组进行排序,结束时数组单元将被从最低到最高 ...
- 动态规划3--Help Jimmy
动态规划3--Help Jimmy 一.心得 二.题目 三.分析 Jimmy跳到一块板上后,可以有两种选择,向左走,或向右走.走到左端和走到右端所需的时间,是很容易算的.如果我们能知道,以左端为起点到 ...
- ubuntu10.04 交叉编译 aria2 总结
1) google之后,找到 这个 https://github.com/z24/pitv/tree/master/cross 的脚本, 觉得非常好. 于是准备用来进行编译 2) 安装交叉编译器 su ...
- Java注解 框架开发之Java注解的妙用
原文出处: locality 注解的好处: 1.能够读懂别人写的代码,特别是框架相关的代码. 2.本来可能需要很多配置文件,需要很多逻辑才能实现的内容,就可以使用一个或者多个注解来替代,这样就使得编程 ...
- Java实现日历小程序【代码】
这个没啥难点的,主要是界面设计吧 界面就是这个样子 运行时请在src同目录下放上我女神的照片 -----------------------------------代码如下-------------- ...
- Isotig & cDNA & gene structure & alternative splicing & gene loci & 表达谱
参考:高通量测序相关名词 Isotig 指在转录组de novo测序时,用454平台测序完成后组装出的结果,一个isotig可视为一个转录本. Isogroup 指转录组de novo测序中,用454 ...
- 20170612xlVBA含方框文档填表
Sub mainProc() Application.ScreenUpdating = False Application.DisplayAlerts = wdAlertsNone 'Dim xlAp ...
- springboot实现java代理IP池 Proxy Pool,提供可用率达到95%以上的代理IP
一.背景 前段时间,写java爬虫来爬网易云音乐的评论.不料,爬了一段时间后ip被封禁了.由此,想到了使用ip代理,但是找了很多的ip代理网站,很少有可以用的代理ip.于是,抱着边学习的心态,自己开发 ...
- os.mkdir()和os.path.join()的区别
os.path.join("D:\","test.txt")结果是D:\test.txt,并且在我们往里面写东西,然后保存,在这个目录下会生成这个文件,但是如果 ...
- Oracle12c中性能优化新特性之新增APPROX_COUNT_DISTINCT 快速唯一值计数函数
Oracle11g中,为了改善DBMS_STATS包收集统计信息时的唯一值计数功能,增加了 APPROX_COUNT_DISTINCT函数,但文档中未记载.Oracle12c文档中包括了该函数,因此, ...