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 dreamone at 2007-08-02 11:06:29 on Problem 1936
#include<stdio.h>
#include<string.h>
char a[100005],b[100005],z[100005][10005];

int main()
{
	int la,lb,i,j;
	while(scanf("%s%s",a+1,b+1))
	{
		la=strlen(a+1);
		lb=strlen(b+1);
		memset(z,0,sizeof(z));
		for(i=1;i<=la;i++)
			for(j=1;j<=lb;j++)
			{
				if(a[i]==b[j])
					z[i][j]=z[i-1][j-1]+1;
				else
				{
					if(z[i][j-1]>z[i-1][j])
						z[i][j]=z[i][j-1];
					else
						z[i][j]=z[i-1][j];
				}
			}
			if(z[la][lb]==la)
				printf("Yes\n");
			else
				printf("No\n");
	}
	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