Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这样做为什么TLE???请大牛帮忙指点下

Posted by wincat at 2007-09-06 10:53:07 on Problem 1200
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator