老师在上课的时候讲过这道题,不过当时做这道题时还是纠结了许久,那时stl不熟,老是想着用数组,去重很麻烦,学了STL后,用map就简单多了。

code :
#include <iostream>#include <string>#include <map>using namespace std;int main() {  map < string, int >m;  string a, k;  int n, max;  while (cin >> n && n) {    m.clear();    while (n--) {      cin >> a;      m[a]++;    }    map < string, int >::iterator it;    max = 0;    for (it = m.begin(); it != m.end(); it++) {      if ((*it).second > max) //遍历寻找最大的气球数
      {        max = (*it).second;        k = (*it).first;      }    }    cout << k << endl;  }  return 0;}

ZOj 2104——Let the Balloon Rise相关推荐

  1. HDU.1004 Let the Balloon Rise

    原题 HDU.1004 Let the Balloon Rise 分类 杂题 题意 找出一组序列中出现次数最多的字符串. 输入/输出 要求与格式 样例数的确定 最后一个样例输入字符串个数为0代表样例输 ...

  2. [HDU1004] Let the balloon rise - 让气球升起来

    [HDU1004] Let the balloon rise - 让气球升起来 Description Contest time again! How excited it is to see bal ...

  3. hdu-1004 Let the Balloon Rise

    题目来源:hdu-1004 Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...

  4. HDOJ 1004 Let the Balloon Rise

    2019独角兽企业重金招聘Python工程师标准>>> 開源中國寫的第一篇日誌 加油 水呀水 ,不過水壓不小,暈死,一晚上就死在了這裡, 回想一下這題真的真的不難 一開始是思路問題, ...

  5. HDOJ_1004_Let the Balloon Rise

    Font Size: ← → Problem Description Contest time again! How excited it is to see balloons floating ar ...

  6. HDU 1004 Let the Balloon Rise (map)

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

  7. 算法设计与分析之ZOJ2104- Let the Balloon Rise

    问题描述 输入   输入有多组测试例.   对每个测试例,第一个数字是N(0<N<1000),表示气球的数量.接下来N行,每行是一个气球的颜色,由小写字母构成的字符串表示,长度不超过15个 ...

  8. hdu1004——Let the Balloon Rise

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

  9. HDU - Let the Balloon Rise(STL)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Time Limit: 2000/1000 MS (Java/Others) Memory Li ...

最新文章

  1. 【VS开发】【DSP开发】WinDriver简介(或介绍)
  2. 同时设置超时时间_刚入职的小菜鸡,设错了RPC超时,搞了个线上事故
  3. 汇编中ah,al,ax;es,cs,ds,ss;
  4. 字母异位词分组—leetcode49
  5. Gym - 215177C 玩游戏
  6. Spring LDAP 2.0.0发布
  7. Linux中变量#,@,0,1,2,*,$$,$?的含义
  8. 再学 GDI+[67]: 路径画刷(7) - 画个五角星
  9. python——Django(ORM连表操作)
  10. 交通路标识别(毕业设计)
  11. 一种基于HBase韵海量图片存储技术
  12. 火灾自动报警系统下综合布线施工要素
  13. 为笔记本添加固态硬盘以及之后的分区方法分享
  14. Robin广场舞案例实践分析之深入思考
  15. 跨平台应用开发进阶(十一) :uni-app 实现IOS原生APP-云打包集成极光推送(JG-JPUSH)详细教程
  16. easypermission坑_Android 权限管理(原生、EasyPermissions、RxPermissions)-阿里云开发者社区...
  17. 残差网络解决什么问题详解残差网络
  18. Netscreen + Squid (Transparent) + c-icap + ClamAV
  19. Excel中VLOOKUP函数的详细用法(灰常有用,求加精!求加精!)
  20. python 字典

热门文章

  1. HTML 中点击a标签,页面跳转执行过程
  2. CSS 学习路线(一)元素
  3. JavaScript日期格式化处理
  4. eclipse 下使用git clone
  5. Android 调用系统的分享[完美实现同一时候分享图片和文字]
  6. UINavigationController的简单使用
  7. 模型和控制器-起步阶段
  8. 通过setTimeout来取消因大量计算造成的网页卡顿
  9. java中的常用日期类_Java中的常用日期类说明
  10. linux 的date命令详解,linux之date命令详解