65,210
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main ()
{
int n;
while(cin>>n)
{
if(n == 0)
break;
map<string ,int> m;
map<string ,int>::iterator index;
string input;
for(int i = 0; i <n;i++)
{
cin>>input;
m[input]++;
}
int max = -1;
for(index=m.begin();index!=m.end();index++)
{
int temp = index->second;
if(temp > max)
max = temp;
}
cout<<max<<endl;
m.clear();
}
return 0;
}
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int main ()
{
int n;
while(cin>>n)
{
if(n == 0)
break;
map<int,int> m;
map<int,int>::iterator index;
int input;
for(int i = 0; i <n;i++)
{
scanf("%d",&input);
m[input]++;
}
int max = -1;
for(index=m.begin();index!=m.end();index++)
{
int temp = index->second;
if(temp > max)
max = temp;
}
cout<<max<<endl;
m.clear();
}
return 0;
}
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main ()
{
int n;
while(cin>>n)
{
if(n == 0)
break;
map<int,int> m;
map<int,int>::iterator index;
int input;
int max = -1;
for(int i = 0; i <n;i++)
{
cin>>input;
m[input]++;
max = max > m[input] ? max : m[input];
}
cout<<max<<endl;
m.clear();
}
return 0;
}
for(index=m.begin();index!=m.end();index++)
{
int temp = index->second;
if(temp > max)
max = temp;
}