/*
参考课件写的程序都有那么多的错误,悲剧了
http://acm.hdu.edu.cn/forum/read.php?tid=7329
http://hi.baidu.com/heiyeshuwu/blog/item/3853baa1ed68b488471064b4.html
http://acm.hdu.edu.cn/forum/read.php?tid=6567
除去马甲,本题的本质是——求相同级别(level)的人最多是几个。
如果level的范围不大的话(64位整数可以表示)——本题很简单,简单贪心
本题的难点:level的范围较大,需用大数或者字符串比较(去首0)
效率较高、编程简单的方法:Hash!
此外,字典树也是不错的选择(下回再写,字典树学的不好)
*/
#include<iostream>//2551140 2010-06-21 00:34:20 Accepted 1800 156MS 292K 862 B C++ 悔惜晟
#include<cstdio>
#include<cstring>
using namespace std;
const int Max = 7003;
int hash[Max];
int count[Max];
int max1;
int Hash(char *url)
{
unsigned long h = 0, g;//一开始我抄模板是用 unsigned int 的
while(*url)
{
h = (h << 4) + *url++;
g = h & 0xf0000000L;
if(g)
h ^= g >> 24;
h &= ~g;
}
return h;
}
void Fun(char *key)//这个函数处理的很巧妙
{
int k;
while(*key == '0') key++;
k = Hash(key);
int t = k % Max;
while( hash[t] != k && hash[t] != -1 )
t = ( t + 10 ) % Max;
if( hash[t] == -1 ) count[t] = 1,hash[t] = k;
else if( ++count[t] > max1 ) max1 = count[t];
}
int main()
{
int n;
char str[35];
while(scanf("%d", &n) != EOF)
{
memset(hash, -1, sizeof(hash));//一定要初始化为-1??
memset(count, 0, sizeof(count));
max1 = 1;
while(n--)
{
scanf("%s", str);
Fun(str);
}
printf("%d/n", max1);
}
}