- #include<iostream>
- usingnamespacestd;
- __int64hash[1000000]={0};
- __int64key;
- __int64total;
- chartext[1600008];
- intnum(0);
- constintprime=999983;
- voidfac(intk)
- {
- if(!hash[k])
- {
- hash[k]=total;
- num++;
- }
- else
- {
- if(hash[k]==total)
- return;
- else
- fac((k+1)%prime);
- }
- }
- intmain()
- {
- //freopen("in.txt","r",stdin);
- intN,NC,l,i,j;
- scanf("%d%d",&N,&NC);
- getchar();
- scanf("%s",text);
- l=strlen(text);
- for(i=0;i<=l-N;i++)
- {
- key=0;
- total=0;
- for(j=i;j<i+N;j++)
- {
- total+=text[j];
- total*=26;
- }
- key=total%prime;
- fac(key);
- }
- cout<<num<<endl;
- return0;
- }
1200
最新推荐文章于 2025-07-08 15:41:49 发布
1万+

被折叠的 条评论
为什么被折叠?



