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:第一次DP做题,秒过,爽

Posted by feather at 2008-06-22 02:16:37 on Problem 1163
In Reply To:第一次DP做题,秒过,爽 Posted by:feather at 2008-06-22 02:15:45
  val[0][0]=res[0][0];

	for(i=1;i<n;i++)
	{
		for(j=0;j<i+1;j++)
		{
			if(j==0)
				val[i][0]=val[i-1][0]+res[i][0];
			else if(j==i)
				val[i][i]=val[i-1][i-1]+res[i][i];
			else
			{
				if(val[i-1][j-1]>=val[i-1][j])
					val[i][j]=val[i-1][j-1]+res[i][j];
				else
					val[i][j]=(val[i-1][j]+res[i][j]);
			}
		}
	}

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