题意

让你统计字符串最多的那个串,并输出

分析

直接用map统计,不断更新最大值即可

代码

#include<iostream>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int main(){ string s,ans;
int n;
//freopen("in.txt","r",stdin);
while(cin>>n&&n){
map<string,int> m;//映射
int maxn=0;
while(n--){
cin>>s;
m[s]++;
if(m[s]>maxn){
maxn=m[s];
ans=s;
}
}
cout<<ans<<endl;
}
return 0;
}

Let the Balloon Rise HDU水题的更多相关文章

  1. hdoj-1004-Let the Balloon Rise(水题)

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

  2. 动态规划之HDU水题

    做水题的感觉真好系列 HDU 2084 数塔 1: 12: 1 23: 1 2 34: 1 2 3 45: 1 2 3 4 5 dp[i][j]第i行第j个数取得的最大值dp[i][j] = max( ...

  3. Let the Balloon Rise(水)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...

  4. Let the Balloon Rise HDU 1004

    Let the Balloon Rise Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other ...

  5. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  6. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  7. HDU 2096 小明A+B --- 水题

    HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...

  8. [HDU 2602]Bone Collector ( 0-1背包水题 )

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 水题啊水题 还给我WA了好多次 因为我在j<w[i]的时候状态没有下传.. #includ ...

  9. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

随机推荐

  1. php中编码转换方法

    php里经常用到编码转换,在这记录一个常用的编码转换方法,字符串.数组.对象都可以使用,使用了递归来解决,比较普通 /* * php中编码转换 * @param $param 需要转换的数据 * @p ...

  2. MySQL面试题之为什么要为innodb表设置自增列做主键?

    为什么要为innodb表设置自增列做主键? 1.使用自增列做主键,写入顺序是自增的,和B+数叶子节点分裂顺序一致 2.表不指定自增列做主键,同时也没有可以被选为主键的唯一索引,InnoDB就会选择内置 ...

  3. nginx limit_rate突然限速失败

    ##问题 nginx限制用户对指定目录的访问: <!-- lang: shell --> location ~ ^/(path001)/ { limit_rate 0k; limit_co ...

  4. Linux 内存使用率

    文章参考: 1.正确计算linux系统内存使用率 2.Linux系统内存消失与slab使用之谜 例如当前主机内存信息如下: [zhang@test ~]$ cat /proc/meminfo MemT ...

  5. MySQL基本简单操作01

    MySQL基本简单操作 学会了安装Docker,那么就将它利用起来.(/滑稽脸) 之前想学习Mysql(Windows下配置真麻烦),学会了Docker就方便了,直接使用Docker创建一个Mysql ...

  6. React学习笔记_01

    使用Facebook的create-react-app快速构建React开发环境 前言: create-react-app:来自Facebook官方的零配置命令行工具 create-react-app ...

  7. 【Java多线程】ReentrantReadWriteLock

    概述 ReentrantReadWriteLock是Lock的另一种实现方式,ReentrantLock是一个排他锁,同一时间只允许一个线程访问,而ReentrantReadWriteLock允许多个 ...

  8. 如何用命令行刷新,启用,禁用Magento2的缓存

    当你使用Magento商店时如何刷新Magento 2中的Cache命令行是基本的常用操作.Magento 2默认有12种缓存类型.在命令行中有5个简单的命令来管理缓存.在这篇文章中,我将逐步向您展示 ...

  9. ceph部署实践(mimic版本)

    一.准备环境 4台adminos7.4 环境,存储节点上两块磁盘(sda操作系统,sdb数据盘) clientadmin storage1storage2storage3 二.配置环境 1.修改主机名 ...

  10. 对Promise的理解?

    ES6原生提供了promise对象 所谓Promise,就是一个对象,用来传递异步操作的消息.它代表了某个未来才会知道结果的事件(通过是一个异步操作),并且这个事件提供统一的API,可供进一步处理 P ...