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

大牛帮看看 哪里 RE了

Posted by howling at 2011-07-11 18:53:15 on Problem 1200
#include<iostream>
#include<string>
using namespace std;
int cmp(char a[],int b1,int b2,int len){
    while(len--){
        if(a[b1]!=a[b2])return 0;
        b1++;
        b2++;
    }
    return 1;
}
int main (){
    char a[16000000];
    int r[16000000];
    memset(r,0,sizeof(r));
    int i=0;
    int j=0;
    int sum=0;
    int n,nc;
    
    cin>>n>>nc;
    cin>>a;
    int len=strlen(a);
    
    for(i=0;i<len-n;i++){
        if(!r[i]){
            for(j=i+1;j<=len-n;j++){
                if(a[i]==a[j]){
                    if(cmp(a,i,j,n)){r[j]=1;sum++;}
                }
            }
        }
    }
    cout<<len-n+1-sum<<endl;

    system("pause");
    return 0;
}

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