您的位置:首页 > 其它

【map/STL】HDU1029Ignatius and the Princess IV

2017-09-06 21:49 267 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin.sync_with_stdio(false);
while(cin>>n){
map<string,int>Map;
int cnt=(n+1)/2;
string ans;
string a;
for(int i=0;i<n;i++){
cin>>a;
Map[a]++;
if(Map[a]>=cnt) ans=a;
}
cout<<ans<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: