ZOJ 2104 Let the Ballon Rise(map解法)
来源:互联网 发布:java初学经典编程20例 编辑:程序博客网 时间:2024/05/14 22:57
题意很简单,就是统计给定字符串序列中出现 最多的串。利用map特性很容易解决问题,对于一些思路比较奇特的题,stl的容器还是比较不错的选择!
代码:
#include <iostream>#include <string> #include <map>using namespace std;int main(){ int n; while(cin>>n&&n) { map <string,int> cnt; string s,maxstring; int maximum=0; for(int i=0;i<n;i++) { cin>>s; cnt[s]++; if(cnt[s]>maximum) { maximum=cnt[s]; maxstring=s; } } cout<<maxstring<<endl; }return 0;}
0 0
- ZOJ 2104 Let the Ballon Rise(map解法)
- HDOJ---1004(Let the Ballon Rise)
- ZOJ 2104/HDU 1004 Let the Balloon Rise(map容器)
- zoj 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- zoj 2104 Let the Balloon Rise
- ZOJ 2104Let the Balloon Rise
- Let the Balloon Rise(Map容器)
- Let the Balloon Rise (map)
- Let The Ballon Raise
- ZOJ Problem Set - 2104 Let the Balloon Rise
- ZOj 2104——Let the Balloon Rise
- ZOJ Problem Set - 2104 Let the Balloon Rise
- zoj 2014 Let the Balloon Rise(水~)
- HDU1004 Let the ballon raise(水题, 字符串的处理)(map简单用法)
- 2104:Let the Balloon Rise——map容器
- Sicily 9994. 3. Computing the weekly hours for each employee
- 如何设计sql数据库,以实现商品自定义属性
- JavaScript系列四:浏览器对象
- Sicily 1159. Sum
- UIGestureRecognizer iOS手势识别器
- ZOJ 2104 Let the Ballon Rise(map解法)
- 微博,qq第三方登陆 绑定--注意点
- 有关springmvc文件上传,出现400 的错误问题
- Tsinsen 清橙 A1010. 进制转换1 (进制转化)
- OpenFire源码学习之二十一:openfie对用户的优化(上)
- win7 硬盘安装linux
- Android Toast用法
- VM下Red Hat Linux 安装VMware tools
- 5个海盗,分100个金币