题意

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

分析

直接用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一维数组去重很简单,直接array_unique($arr)即可,但是二维数组去重就得自己去写了 二维数组去重方法: /* * 二维数组去重 * 注意:二维数组中的元素 ...

  2. Python基础知识:测试代码

    1.Python标准库中的模块unittest提供了代码测试工具. 单元测试用于核实函数的某个方面没有问题: 测试用例是一组单元测试,这些单元测试一起核实函数在各种情形下的行为都符合要求. 通俗的理解 ...

  3. 命令行方式安装Pycharm

    sudo apt install snapd snapd-xdg-open snap refresh sudo snap install pycharm-professional --classic

  4. 方程:方程(equation)是指含有未知数的等式

    方程(equation)是指含有未知数的等式.是表示两个数学式(如两个数.函数.量.运算)之间相等关系的一种等式,使等式成立的未知数的值称为“解”或“根”.求方程的解的过程称为“解方程”. 方程中文一 ...

  5. 布隆过滤BitMap原理

    一.问题引入 BitMap从字面的意思,很多人认为是位图,其实准确的来说,翻译成基于位的映射,怎么理解呢?举一个例子,有一个无序有界int数组{1,2,5,7},初步估计占用内存44=16字节,这倒是 ...

  6. lij IDEA项目包分层结构显示设置

    使用Intellij IDEA创建项目发现包没有分层,使用不方便. 可以点击右上角的设置,把红框选项的√去掉即可. 就会分层显示了,这就很舒服了.

  7. Choosing number ZOJ - 3690 (矩阵快速幂)

    题意:n个人站成一排,每个人任意从1——m中任意取一个数,要求相邻两个人的如果数字相同,数字要大于k. 分划思想推导表达式: 假设  i  个人时.第i个人的选择有两种一种是选择小于等于k的数,另一种 ...

  8. 【转】python中的一维卷积conv1d和二维卷积conv2d

    转自:https://blog.csdn.net/qq_26552071/article/details/81178932 二维卷积conv2d 给定4维的输入张量和滤波器张量来进行2维的卷积计算.即 ...

  9. 浅谈Java泛型中的extends和super关键字

    泛型是在Java 1.5中被加入了,这里不讨论泛型的细节问题,这个在Thinking in Java第四版中讲的非常清楚,这里要讲的是super和extends关键字,以及在使用这两个关键字的时候为什 ...

  10. 序号生成算法odoo

    def get_sum_seq(self, cr, uid, ids, name, args=None, context=None): if not ids: return {} result={} ...