HDU 1004 - Let the Balloon Rise(map 用法样例)
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
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
map<string,int> col;
string tmp,ans;
int n,max;
while(cin>>n,n){
col.clear();
while(n--){
cin>>tmp;
col[tmp]++;
}
max=;
map<string,int>::iterator it;
for(it=col.begin();it!=col.end();it++){
if(it->second>max){
max=it->second;
ans=it->first;
}
}
cout<<ans<<endl;
} return ;
}
HDU 1004 - 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 ...
- HDU 1004 Let the Balloon Rise(map应用)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- 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 ...
- hdu 1004 Let the Balloon Rise(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...
- 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 ...
- 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 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 #include <iostream> #includ ...
- hdu 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(STL初体验之map)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
随机推荐
- Eclipse 常用快捷键 (动画讲解)(转载)
http://www.cnblogs.com/TankXiao/p/4018219.html#fix 很详细呀/
- checkbox,radio,selected相关操作
1.radio:单选框 HTML代码: <input type="radio" name="radio" id="radio1" va ...
- Repository,UnitOfWork,DbContext(1)
一.前言 终于到EF了,实在不好意思,最近有点忙,本篇离上一篇发布已经一个多星期了,工作中的小迭代告一段落,终于有点时间来继续我们的架构设计了,在这里先对大家表示歉意. 其实这段时间我并不是把这个系列 ...
- 关于Oracle中查询结果为未选定行
今天在做关于Oracle查询语句的练习时,碰到这么一个题目:找出EMP表中姓名(ENAME)第三个字母是A的员工姓名.我的Scott.emp表的现有数据如下: SQL> select * fro ...
- c#之process类相关整理
一.根据进程名获取进程的用户名? 需要添加对 System.Management.dll 的引用 using System.Diagnostics; using System.Manageme ...
- Spring-----8、深入理解容器中的bean
转载自:http://blog.csdn.net/hekewangzi/article/details/45648687
- Direct2D WIC绘制图片
绘制图片需要用到WIC,WIC的功能包括: 编解码图片.也可以自定义图片解码插件. 读取图片元数据. 图像处理(最高支持每通道32位). 内置支持一些流行的格式.包括:BMP v5, GIF 89a/ ...
- Android Studio默认产生Fragment
package com.edaixi.fragment; import android.content.Context;import android.net.Uri;import android.os ...
- php 函数之 )_each()list()implode()explode()in_array()
<?php /* implode() 把数组组合成字符串 explode() 把字符串分割成数组 in_array() 检测内容是否在数组中 each()把数组元素拆分成新的数组 list() ...
- java学习一目了然——File类文件处理
java学习一目了然--File类文件处理 File类(java.io.File) 构造函数: File(String path) File(String parent,String child) F ...