Let the Balloon Rise(1004)
2014-03-13 14:12
253 查看
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1004
#include<stdio.h>
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
int n;
string str;
while(cin>>n&&n){
map<string,
int>m;
map<string,
int>::iterator ip,imax;
for(inti =
0;i <n;i++){
cin>> str;
m[str]++;
}
int max =0;
for(ip =m.begin();ip != m.end();ip++){
if(ip->second > max){
max =ip->second;
imax = ip;
}
}
cout<< imax->first <<endl;
}
return 0;
}
#include<stdio.h>
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
int n;
string str;
while(cin>>n&&n){
map<string,
int>m;
map<string,
int>::iterator ip,imax;
for(inti =
0;i <n;i++){
cin>> str;
m[str]++;
}
int max =0;
for(ip =m.begin();ip != m.end();ip++){
if(ip->second > max){
max =ip->second;
imax = ip;
}
}
cout<< imax->first <<endl;
}
return 0;
}
相关文章推荐
- 数值统计(2008)
- 平方和与立方和(2007)
- 3月全球Web服务器:Apache份额回升至38.6%居首
- 如何吸取老辈的经验成长,90后的我们
- 设计安全的多线程应用程序(线程安全)
- 使用UpdatePanle的时候里面控件事件失效
- linker command failed with exit code 1 解决
- 堆栈模板
- scrollTop(转)
- 自动备份并保存最近几天的SQL数据库作业脚本
- 求奇数的乘积(2006)
- 第几天?(2005)
- 求绝对值(2003)
- 计算球体积(2002)
- 计算两点间的距离(2001)
- ASCII编码排序(2000)
- C语音合法标识符
- 【ObjC那点儿事儿】OC对象内存管理 MRR
- 成绩转换程序(2004)
- Tomcat 环境变量配置