本文整理汇总了C++中hash_map::init方法的典型用法代码示例。如果您正苦于以下问题:C++ hash_map::init方法的具体用法?C++ hash_map::init怎么用?C++ hash_map::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hash_map
的用法示例。
在下文中一共展示了hash_map::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
mutpower[0] = 1;
for (int i = 1; i < maxn; i++)
mutpower[i] = mutpower[i-1]*muts;
hash.init();
int totcas;
scanf("%d",&totcas);
for (int cas = 1; cas <= totcas; cas++)
{
scanf("%s",s);
printf("Case #%d: %d\n",cas,calc(s));
}
return 0;
}
示例2: main
int main()
{
freopen("1.in","r",stdin);
freopen("3.out","w",stdout);
int totcas;
scanf("%d",&totcas);
//totcas = 20;
hash.init();
for (int cas = 1; cas <= totcas; cas++)
{
//for (int i = 0;i < maxn-10;i++)
// s[i] = rand()%1+'a';
//s[maxn-10] = 0;
scanf("%s",s);
len = strlen(s);
Manacher(s,len);
sum[0] = s[0];
mutpower[0] = 1;
for (int i = 1; i < len; i++)
{
mutpower[i] = (long long)mutpower[i-1]*muts%mods;
sum[i] = (sum[i-1]+(long long)s[i]*mutpower[i])%mods;
}
int res = 0;
int tmp;
//for (int i = 0;i < len*2+2;i++)
// printf("%2d ",Mp[i]);
//printf("\n");
if (cas == 10)
{
for (int i = 10000;i < len;i++)
for (int j = i-100;j <= i;j++)
printf("%d\n",gethashcode(j,i));
}
hash.clear();
//odd
for (int i = 0; i < len; i++)
if (Mp[i*2+2]%2 == 0)
{
int pl = Mp[i*2+2]/2;
for (int j = i-pl+1; j <= i; j++)
{
tmp = gethashcode(j,i);
if (hash.fint(tmp) != -1) break;
hash.insert(tmp);
}
}
res += hash.N;
hash.clear();
//even
for (int i = 0; i < len; i++)
if (Mp[i*2+3] > 1)
{
int pl = Mp[i*2+3]/2;
for (int j = i-pl+1; j <= i; j++)
{
tmp = gethashcode(j,i);
if (hash.fint(tmp) != -1) break;
hash.insert(tmp);
}
}
res += hash.N;
printf("Case #%d: %d\n",cas,res);
}
return 0;
}