题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004

用STL 中的 Map 写的

 #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <map>
using namespace std; map<string, int> ballon;
string tmp; int main()
{
int i, j, n;
while (cin >> n && n)
{
ballon.clear();
for (i = ; i < n; i++)
{
cin >> tmp;
ballon[tmp]++;
}
map<string, int>::iterator iter, poi;
int maxp = ;
for (iter = ballon.begin(); iter != ballon.end(); iter++)
{
if (maxp < iter->second)
{
maxp = iter->second;
poi = iter;
}
// cout << iter->first << " " << iter->second << endl;
}
cout << poi->first << endl;
}
return ; }

hdu 1004 Let the Balloon Rise 解题报告的更多相关文章

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

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

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

  4. hdu 1004 Let the Balloon Rise

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

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

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

  7. HDU 1004 - Let the Balloon Rise(map 用法样例)

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

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

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

  9. Winter-1-E Let the Balloon Rise 解题报告及测试数据

    Time Limit:1000MS     Memory Limit:32768KB Description Contest time again! How excited it is to see ...

随机推荐

  1. JavaSwing仿QQ登录界面,注释完善,适合新手学习

    使用说明: 这是一个java做的仿制QQ登录界面,界面仅使用一个类, JDK版本为jdk-11 素材包的名字为:素材(下载)请在项目中新建一个名字为“素材”的文件夹. 素材: https://pan. ...

  2. java计算年龄

    精确到天计算年龄 public static int getAgeByCardId(String card) throws Exception { Integer len = card.length( ...

  3. visual studio usage tips

    reset all settings on visual stdio microsoft visual studio X\common7\ide\devenv.exe /setup /resetuse ...

  4. Linux包括hash_map和hash_set的not declared问题

    当在Linux下cpp文件包括hash_map或hash_set时.会出现"'hash_map' was not declared in this scope"问题. #inclu ...

  5. poj 1651 Multiplication Puzzle【区间DP】

    题目链接:http://poj.org/problem? id=1651 题意:初使ans=0,每次消去一个值,位置在pos(pos!=1 && pos !=n) 同一时候ans+=a ...

  6. nginx-location rewrite

    location 语法 location 有”定位”的意思, 根据Uri来进行不同的定位. 在虚拟主机的配置中,是必不可少的,location可以把网站的不同部分,定位到不同的处理方式上. 比如, 碰 ...

  7. hadoop集群搭建datenode为0问题的解决

       搭建了一个小的实验集群,一共4台机器,一台namenode,三台datenode.运行start-all,发如今namenode上没有报不论什么错误,可是启动后直接显示datenode数量为0. ...

  8. 【凯子哥带你夯实应用层】使用ActionProvider实现子菜单时遇到的一个坑

    转载请注明出处:http://blog.csdn.net/zhaokaiqiang1992 近期在重温Android基础.在看到ActionProvider的时候遇到一个坑.分享到大家,避免入坑. 首 ...

  9. UVA 610 - Street Directions(割边)

    UVA 610 - Street Directions option=com_onlinejudge&Itemid=8&page=show_problem&category=5 ...

  10. 浅析嵌入式C优化技巧

    嵌入式C语言优化小技巧 1 概述 嵌入式系统是指完毕一种或几种特定功能的计算机系统,具有自己主动化程度高,响应速度快等长处,眼下已广泛应用于消费电子,工业控制等领域.嵌入式系统受其使用的硬件以及运行环 ...