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 ...
随机推荐
- [Android教程] Cordova开发App入门(一)创建android项目
前言 Apache Cordova是一个开源的移动开发框架.允许使用标准的web技术-HTML5,CSS3和JavaScript做跨平台开发. 应用在每个平台的具体执行被封装了起来,并依靠符合标准的A ...
- LeetCode--111--最长公共前缀
问题描述: 给定一个二叉树,找出其最小深度. 最小深度是从根节点到最近叶子节点的最短路径上的节点数量. 说明: 叶子节点是指没有子节点的节点. 示例: 给定二叉树 [3,9,20,null,null, ...
- RabbitMq windows 安装
参考官方网址: http://www.rabbitmq.com/install-windows-manual.html http://www.rabbitmq.com/install-windows. ...
- Dubbo项目一段时间后提供者消失
Dubbo项目用了一段时间后发现接口不通了,错误500 打开监控中心发现提供者不见了 查看下日志文件发现报如下错 2018-08-06 15:10:18,008 [localhost-startSto ...
- hdu1686字符串kmp
The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e ...
- jquery添加类
一.addClass() 方法向被选元素添加一个或多个类. 1.对P元素添加一个intro类.<!DOCTYPE html><html><head lang=" ...
- 在命令行中直接运行带main方法的java
用了很久的java,基本都是交给服务器完成的执行,有page之类的入口,或者是在IDE工具中直接 Run As Java Application. 并且一直对安装java之后配置JAVA_HOME,p ...
- Oracle OAF 应用构建基础之实现控制器 (转)
原文地址: Oracle OAF 应用构建基础之实现控制器 设计一个OA Controller 如OA Framework Page解析中所描述的,OA Controller定义了web beans的 ...
- Error: [ng:areq] Argument 'LoginCtrl' is not a function, got undefined
- Visual C++ 使用纪要
1.取消在查找中标记的蓝色小方块 Ctrl+Shift+F2 取消所有标记 2.出现LINK错误 : fatal error LNK1168: cannot open Debug/x.exe for ...