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 2015214125 at 2017-02-08 09:52:50 on Problem 2217
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:
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