题目链接: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 ; }

最新文章

  1. Entity Framework之IQueryable和list本地集合
  2. java 27 - 7 反射之 通过反射越过泛型检查
  3. HDU 5876 Sparse Graph BFS 最短路
  4. 使用Adivisor配置增强处理
  5. jquery中各个事件执行顺序如下:
  6. [访问系统] Api_Win32_Mac类工具包 (转载)
  7. J2EE ssm框架-服务启动项内存加载数据及读取。
  8. Getting Started with the NDK
  9. 基于basys2驱动LCDQC12864B的verilog设计图片显示
  10. Tensorflow之MNIST解析
  11. webpack分片chunk加载原理
  12. vue中使用stylus
  13. 【UOJ 351】新年的叶子
  14. js的style.display小问题
  15. SQLSERVER将数据移到另一个文件组之后清空文件组并删除文件组
  16. git push.default设置
  17. ZH奶酪:LAMP环境中如何重新部署一个Yii2.0 web项目
  18. idea svn 使用问题
  19. android动态设置边框颜色
  20. gcc/g++ 命令的常用选项

热门文章

  1. 提高速度 history 的利用
  2. http put/delete方式请求
  3. java判断日期与星期
  4. [__NSCFConstantString size]: unrecognized selector sent to instance 错误
  5. GOF23种设计模式-工厂模式
  6. python 依照list中的dic的某key排序
  7. vdWebControl.js去水印
  8. Spring Cloud(十二):Spring Cloud Zuul 限流详解(附源码)(转)
  9. 服务管理-DHCP、NTP、SSH
  10. Linux驱动经典面试题目