| 题目链接 | 难度等级 | 完成状态 | 完成分数 | 最后编辑时间 | 需要注意 |
|---|---|---|---|---|---|
| Let the Balloon Rise | ★☆☆☆☆ | 答案正确 | 100 | 2015-02-06 11:06:55 | 无 |
给一组字符串,求出现最多的一个。
| 1004.cpp代码已折叠
展开折叠内容
|
|---|
#include<cstdio>
#include<set>
#include<string>
#include<iostream>
#define F(i,n) for(int i=1;i<=n;++i)
using namespace std;
multiset<string> S;
int main()
{
while(1)
{
int n,ans=0;
cin>>n;
if(!n)
return 0;
string s,ansS;
F(i,n)
{
cin>>s;
S.insert(s);
if(S.count(s)>ans)
{
ans=S.count(s);
ansS=s;
}
}
cout<<ansS<<endl;
}
}
|