[HDUOJ] 1004 Let the Balloon Rise
来源:互联网 发布:阿里云建立远程连接 编辑:程序博客网 时间:2024/06/07 06:10
题意:给气球的颜色,求数量最多的颜色。
分析:map乱搞
代码:
#include<stdio.h> #include<cstring> #include<algorithm> #include<iostream>#include<vector>#include<set>#include<string>#include<sstream>#include<map>#include<list>#include<queue>using namespace std; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); //ios::sync_with_stdio(false); int n ; string str ; while(~scanf("%d",&n)&&n){ map<string,int> mp ; while(n--){ cin>>str; mp[str]++; } int ans = 0 ; map<string,int>::iterator it , it2 ; for(it = mp.begin() ; it != mp.end(); it++){ if(it->second>ans){ ans = it->second ; it2 = it ; } } cout<<it2->first<<endl; } return 0 ; }
0 0
- HDUOJ Let the Balloon Rise 1004
- HDUOJ 1004 - Let the Balloon Rise
- HDUoj- 1004 -Let the Balloon Rise ( map
- [HDUOJ] 1004 Let the Balloon Rise
- HDUOJ Let the Balloon Rise
- HDUOJ 1004 Let the Balloon Rise(map容器)
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004let the balloon rise
- Let the Balloon Rise 1004
- 1004 Let the Balloon Rise
- Let the Balloon Rise(1004)
- 1004Let the Balloon Rise
- Let the Balloon Rise(1004)
- Let the Balloon Rise(1004)
- 1004:Let the Balloon Rise
- 1004 let the balloon rise
- 字符串转换成int
- SpringMVC数据回显
- 动态规划基础之矩阵取数问题 51nod1083
- Request对象的主要方法有哪些?
- JavaScript parseInt() 函数
- [HDUOJ] 1004 Let the Balloon Rise
- HDU2089 一段区间内数字没有62和4的个数
- Java 中带参无返回值方法的使用
- POJ 1733 Parity game 带权并查集
- java的equals和hashCode
- POJ 2421 Constructing Roads 最小生成树
- 哈希表内容的详细整合
- python 中numpy.transpose()的用法
- List和数组之间的相互转换