hdoj 1004 Let the Balloon Rise(map)
来源:互联网 发布:java hello world 代码 编辑:程序博客网 时间:2024/05/20 06:55
Let the Balloon Rise(链接)
Sample Input
5greenredblueredred3pinkorangepink0
Sample Output
redpink
输出出现次数最多的颜色 用map存一下就好了
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<map>using namespace std;int main(){ map<string,int> B; string Color,Max; int n; while(~scanf("%d",&n)&&n!=0) { B.clear(); while(n--) { cin>>Color; B[Color]++; } int max=0; map<string,int>::iterator it; //迭代器 for(it=B.begin();it!=B.end();it++) { if(it->second>max) { max=it->second; //只能用 -> 不可以用dian点. Max=it->first; } } cout<<Max<<endl; } return 0;}
阅读全文
0 0
- HDOJ 1004 Let the Balloon Rise (map)
- hdoj 1004 Let the Balloon Rise (map)
- hdoj 1004 Let the Balloon Rise(map)
- HDOJ-1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- hdoj 1004 Let the Balloon Rise
- hdoj.1004 Let the Balloon Rise 20140726
- HDOJ Let the Balloon Rise 1004
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise(水题)
- 【HDOJ】【1004】Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDoj 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- fail-fast 与 fail-safe 机制有什么区别
- Java SecurityManager相关概念理解
- 周末训练笔记+UVA138+HDU2973【筛素数】【威尔逊定理】
- SpringBoot事务管理
- Java虚拟机的基本结构
- hdoj 1004 Let the Balloon Rise(map)
- 用BASS库重采样音频
- [leetcode]解决Move Zeroes的一点小心得
- Ubuntu下挂载硬盘剩余空间
- 交互式python shell
- 编写一个程序,可以一直接收键盘字符,如果是小写字符就输出对应的大写字符,如果接收的是大写字符,就输出对应的小写字符,如果是数字不输出
- tcp wcf
- ECMAscript5 手册
- 使用cp、mv命令时不询问