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排序)的更多相关文章

  1. 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 ...

  2. HDOJ 1004 Let the Balloon Rise (字符串+stl)

    题目: Problem Description Contest time again! How excited it is to see balloons floating around. But t ...

  3. HDOJ 1004 Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  4. HDU 1004 Let the Balloon Rise(map应用)

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 杭电1004 Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

随机推荐

  1. C#数组实践

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cont ...

  2. 使用BUCK进行iOS项目打包

    关于BUCK BUCK是Facebook开源的快速打包工具,可以用于多种语言及平台的项目打包,例如:C.C++.Java.iOS.Android等等.用于大型的iOS.Android项目,可以显著提升 ...

  3. 010_Hadoop配置测试成功后关机重启浏览器打不开dfs和MP

    针对Hadoop成功配置并测试通过,第二次(关机重启)后Hadoop打不开的问题,一般都是因为防火墙的问题,将防火墙关闭后就可以了. 更细致的现象为start-all.sh启动,五大守护进程启动成功, ...

  4. C++ IPv4与IPv6的兼容编码(转,出自http://blog.csdn.net/ligt0610/article/details/18667595)

    这里不再对IPv6 socket相关编程的基础知识进行讲解,只提供一个IP协议无关的服务端和客户端的代码,仅供参考. 服务端代码: #include <iostream> #include ...

  5. 【HackerRank】Missing Numbers

    Numeros, The Artist, had two lists A and B, such that, B was a permutation of A. Numeros was very pr ...

  6. 【转载】OPENWRT入门之四------openwrt命令行模式命令及其工具

    连接来源http://bbs.xiaomi.cn/thread-9734746-1-1.html 需要学会用ssh登录路由器用linux命令查看.ps 命令查看当前系统运行的进程信息free 命令查看 ...

  7. 一个由自增运算符以及C语法顺序细节引起的bug

     一.问题描述 在编写modbus代码时发生一件由语法细节引起的bug,起因是自增运算符以及C语法顺序. 输入的数据是2233=0X08B9,高低字节顺序是0x08 0xB9, 使用modbus po ...

  8. SOA 面向服务架构 阅读笔记(六)

    20 SOA质量 服务质量是成功的关键因素 20.1 了解SOA带来的无法预料的挑战 不同部门开发 每个开发的组件整合在一起,形成复合应用程序 整合业务流程,考虑质量问题 衡量SOA的质量. 事物质量 ...

  9. pagination结合ajax

    function getContent(page,Id){ $.ajax({ type:'get', url:'www.baidu.com', dataType:'jsonp', data:{ }, ...

  10. debian下使用dynamic printk分析usb转串口驱动执行流程

    看了一篇文章<debug by printing>,文中提到了多种通过printk来调试驱动的方法,其中最有用的就是"Dynamic debugging". “Dyna ...