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:哪位高人给几组测试文字吧,我这程序有哪些情况没考虑到啊??In Reply To:哪位高人给几组测试文字吧,我这程序有哪些情况没考虑到啊?? Posted by:yiyiyi4321 at 2005-07-29 17:05:02 > #include<stdio.h> > main() > {int i,j,k,max,count,n,c[1000]; > char a[10002],b[10002]; > scanf("%d",&n); > getchar(); > for(i=0;i<n;i++) > {j=k=0; > while((a[j]=getchar())!='\n')j++; > while((b[k]=getchar())!='\n')k++; > j=k=max=count=0; > while(a[j]!='\0') > {k=0; > while(b[k]!='\0') > {if(b[k+count]==a[j+count]) > count++; > else {if(count>max)max=count; > count=0; > k++;} > } > j++; > } > c[i]=max; > } > for(i=0;i<n;i++) > {printf("Nejdelsi spolecny retezec ma delku %d.",c[i]); > if(i<n-1)printf("\n"); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator