Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为啥老是RE啊#include<stdio.h> #include<string.h> int main() { char c[8000000]; int hash[8000000],n,count=0,nc,size,du[1300]={0},size1=0,i,sum,hash1[8000000]={0},j; scanf("%d%d",&n,&nc); scanf("%s",c); size=strlen(c); for(i=0;i<size;i++) { if(du[c[i]]==0)du[c[i]]=size1; size1++; } for(i=0;i<=size-n;i++) { sum=0; for(j=i;j<i+n;j++) { sum=sum*nc+du[c[j]]; } if(hash1[sum]==0) { hash1[sum]=1; count++; } } printf("%d\n",count); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator