F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20613784_25678.cpp:4:25: error: stray '#' in program
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                         ^
0_0_20613784_25678.cpp:4:26: error: 'define' does not name a type
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                          ^
0_0_20613784_25678.cpp:4:64: error: 'MAXN' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                                                                ^
0_0_20613784_25678.cpp:4:72: error: 'MAXN' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                                                                        ^
0_0_20613784_25678.cpp: In function 'void getnext(int, int)':
0_0_20613784_25678.cpp:4:151: error: 'ne' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                                                                                                                                                       ^
0_0_20613784_25678.cpp:4:174: error: 'p' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                                                                                                                                                                              ^
0_0_20613784_25678.cpp:4:234: error: 'p' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;        }    }    for(int i=last+1;s[i];i++)        m++;    ans=m;    return -1;}int main(){    int cas=1;    while(scanf("%s",&s)!=EOF)    {        memset(ne,0,sizeof(ne));        p[0]=s[0];        p[1]='\0';        ans=1;        kmp(1);        printf("Case %d: %d\n",cas++,ans);    }}
                                                                                                                                                                                                                                          ^
0_0_20613784_25678.cpp: In function 'int updata(int, int, int)':
0_0_20613784_25678.cpp:4:451: error: 'p' was not declared in this scope
     using namespace std;#define MAXN 100005int ne[MAXN];char s[MAXN],p[MAXN];void getnext(int n,int st){    for(int i=st+1;i<n;i++)    {        int j=ne[i];        while(j&&p[i]!=p[j])        {            j=ne[j];        }        if(p[i]==p[j])        {            ne[i+1]=j+1;        }        else        {            ne[i+1]=0;        }    }}int ans;int updata(int last,int now,int st){    int len=st+1;    for(int i=last+1;i<=now;i++)    {        p[len++]=s[i];    }    p[len]='\0';    getnext(len,st);    return len;}int kmp(int m){    getnext(m,0);    int j=0;    int last;    for(int i=0;s[i];i++)    {        while(j&&s[i]!=p[j])            j=ne[j];        if(j==0&&s[i]!=p[j])        {            m=updata(last,i,m-1);            last=i;        }        if(s[i]==p[j])          j++;        if(j==m)        {            last=i;


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 18:31:33, Gzip enabled