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

求解脱啊!!!!!!!!!!!!!!!11到底哪错了啊!!!!!!!!!!跪求解释啊

Posted by z55872452006 at 2010-07-29 17:12:00 on Problem 1159
# include<stdio.h>
# include<memory.h>
short dp[2][5000],i,j,len;
char a[5000];
main()
{	
	scanf("%d %s",&len,a);
	memset(dp,0,sizeof(dp));
	for(i=1;i<=len;i++)
		for(j=1;j<=len;j++)
		{
			if(a[i-1]==a[len-j]) dp[i%2][j]=dp[(i-1)%2][j-1]+1;
			else dp[i%2][j]=(dp[(i-1)%2][j]>dp[i%2][j-1]?dp[(i-1)%2][j]:dp[i%2][j-1]);
		}
		printf("%d\n",len-dp[len%2][len]);
}

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