1800
使用哈希。map好像也可以做但是很容易超时。
#include<bits/stdc++.h>
using namespace std;
int n;
int Hash[3010];
char str[40];
int BHash(char* s)
{
long long seed=131;
long long h=0;
while(*s=='0')s++;
while(*s)
{
h=h*seed+(*s++);
}
return h;
}
int main()
{
while(scanf("%d",&n)!=EOF)
{
int ans=1;
for(int i=0;i<n;i++)
{
getchar();
scanf("%s",str);
Hash[i]=BHash(str);
}
sort(Hash,Hash+n);
int temp=1;
for(int i=1;i<n;i++)//ans即相等的数的最大值
{
if(Hash[i]==Hash[i-1])
{
temp++;
if(temp>ans)ans=temp;
}
else temp=1;
}
printf("%d\n",ans);
}
return 0;
}