hdoj-1004-Let the Balloon Rise(map排序)
map按照value排序
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
#include <utility>
using namespace std;
typedef pair<string, int> PAIR;
bool cmp_by_value(const PAIR& lhs, const PAIR& rhs) {
return lhs.second > rhs.second;
}
map<string ,int> ship;
int main() {
int n;
while (cin>>n, n) {
ship.clear();
for (int i=; i<n; i++) {
string tmp;
cin>>tmp;
ship[tmp]++;
}
vector<PAIR> vec(ship.begin(), ship.end());
sort(vec.begin(), vec.end(), cmp_by_value);
cout<<vec.begin()->first<<endl;
}
return ;
}
hdoj-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 ...
- HDOJ 1004 Let the Balloon Rise (字符串+stl)
题目: Problem Description Contest time again! How excited it is to see balloons floating around. But t ...
- HDOJ 1004 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(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 ...
- 杭电1004 Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
随机推荐
- pip升级或卸载安装的包的方法
先 pip list 看看包的具体名字是什么,然后 pip uninstall **包名** ===== 打印出有新版本的包: pip list --outdated --format=freeze ...
- 于win2008R2虽然激活,但是一个小时之后就会自动强制关机的问题
写一个批处理文件: taskkill /f /im wlms.exeping -n 4 127.0.0.1shutdown -a 用记事本写下以上的命令,另存为.bat 批处理文件.双击运行,即可. ...
- java对象生命周期概述复习
最近看了下java对象的生命周期做个笔记复习复习,很多不同的原因会使一个java类被初始化,可能造成类初始化的操作: 1) 创建一个java类的实例对象. 2) 调用一个java类中的静态方法. ...
- Web前端开发的基本要求和认识
Web前端开发技术包括三个要素:HTML.CSS和JavaScript,但随着RIA的流行和普及,Flash/Flex.Silverlight.XML和服务器端语言也是前端开发工程师应该掌握的.Web ...
- 每天一个Linux命令(42)watch命令
watch命令以周期性的方式执行给定的指令,指令输出以全屏方式显示. (1)用法: 用法: watch [参数] [命令] (2)功能: 功能: 可 ...
- $百度应用引擎BAE的使用与应用部署
百度应用引擎(BAE)是百度推出的网络应用开发平台,开发者使用BAE不需要进行服务器的配置.维护等繁琐的工作,也不需要进行域名的申请.备案等工作,而只需要上传自己的WEB应用即可在公网上访问.使用及部 ...
- git全局忽略
今天在提交一个本地新建的build文件夹内的文件时,sourceTree始终无法找到该文件夹下的任何内容,但是项目中的.gitignore中并没有写/build/配置,于是开始了填坑之路! 首先从表象 ...
- yield 表达式形式的应用
import random foods=['banana','apple','peach','grape','pear'] def deco(func): def wrapper(*args,**kw ...
- CSS伪元素实现的3D按钮
在线演示 本地下载
- volatile笔记
总结自:https://www.cnblogs.com/dolphin0520/p/3920373.html 了解volatile之前得明白什么是原子性.可见性.有序性及指令重排序,详见:https: ...