HDU 1004 Let the Balloon Rise
来源:互联网 发布:redis mac 安装配置 编辑:程序博客网 时间:2024/06/06 07:02
查看原题
题意
输入颜色输出数量最多的颜色
思路
map
代码
#include <iostream>#include <map>#include <string>using namespace std;int main(int argc, char *argv[]){ int n; string colors[1000]; map<string,int> m; while(cin>>n){ int temp=0; string t=""; m.clear(); if(n==0){ return 0; } else{ for(int i=0;i<n;i++){ cin>>colors[i]; m[colors[i]]++; if(m[colors[i]]>temp){ temp=m[colors[i]]; t=colors[i]; } } cout<<t<<endl; } } return 0;}
0 0
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- Hdu 1004 - Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004--Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise STL
- IPC简介
- Internet Protocol Address and Network Mask
- 二分树状数组-洛谷P1168 中位数
- shell(1)shell概述
- 程序员的英语学习!!对于像进一步提升自己的人来说,很重要哟!
- HDU 1004 Let the Balloon Rise
- 字符串长度的计算:sizeof和strlen的使用
- GIMR默认使用HugePages
- 做一个罐子
- Ubuntu下把桌面路径改成自定义路径
- iOS开发笔记之六十二——如何构建大型App的Crash符号化系统
- 让EditText不能粘贴和不能输入多个小数点(并防止死循环)
- php关联数组与索引数组及其显示
- linux 常用命令