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

为什么用滚动数组不好使啊???

Posted by pppooo at 2009-06-05 19:59:22 on Problem 3356
int dp(int l1,int l2)
{
	int i ,j;
	int k = 1;
    memset(len,0,sizeof(len));
	
	for(i = 1; i <= l1; i++)
	{
		for (j = 1; j <= l2;j++)
		{
			if (str1[i] == str2[j]) len[k][j] = len[1 - k][j-1]+1;			
			
			else if (len[1 - k][j] >= len[k][j-1]) len[k][j] = len[1 - k][j];				
			
			else len[k][j] = len[k][j-1];	
		}
		k = 1 - k;
	}
	return (max(l1,l2) - len[1 - k][l2]);
}
/*
char str1[1001],str2[1001];
int len[2][1001];
*/

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