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 |
这样做为什么TLE???请大牛帮忙指点下#include<iostream> #include<cstdio> #include<map> using namespace std; map <string,long > p; char tot[16000005],tmp[16000005]; main() { __int64 n,nc,i,count,j,k,use=1; string to; while(EOF!=scanf("%I64d%I64d",&n,&nc)) { scanf("%s",tot); count=0; p.clear(); for(i=0;tot[i+n-1]!='\0';i++) { k=0; for(j=i;j<i+n;j++) tmp[k++]=tot[j]; tmp[k]=0; to=tmp; if(!p[to]) { count++; p[to]=1; } } printf("%I64d\n",count); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator