首页 > 其他 > 详细

hdu_1004 Let the Balloon Rise

时间:2017-06-23 13:31:30      阅读:277      评论:0      收藏:0      [点我收藏+]
#include<bits/stdc++.h>
using namespace std;
int n,vmax;
string x,smax;
map<string,int> m;
map<string,int>::iterator p;

int main(){
    while(scanf("%d",&n) && n!=0){
        m.clear();
        vmax=0;
        while(n--){
            cin>>x;
            if(m.find(x)==m.end())m[x]=1;
            else m[x]++;
        }
        for(p=m.begin();p!=m.end();p++){
            if(p->second>vmax){
                vmax=p->second;
                smax=p->first;
            }
        }
        cout<<smax<<endl;
    }
    return 0;
}

hdu_1004 Let the Balloon Rise

原文:http://www.cnblogs.com/codetogether/p/7069414.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!