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<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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator