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

Sample求解过程,WA到歇菜的同鞋看看吧。

Posted by fish47 at 2012-03-18 21:21:44 on Problem 1157 and last updated at 2012-03-18 21:26:54
f(i, j) 把j号花放在i号花瓶所能获得的最大价值

3 5
 7   23   -5   -24    16
 5   21   -4    10    23
-21   5   -4   -20    20

f(1,1) = 7
f(1,2) = INT_MIN
f(1,3) = INT_MIN

f(2,1) = 23
f(2,2) = 21 + f(1,1) = 21 + 7 = 28
f(2,3) = INT_MIN

f(3,1) = -5
f(3,2) = -4 + max{f(2,1), f(1,1)} = -4 + f(2,1) = -4 + 23 = 19
f(3,3) = -4 + max{f(2,2), f(1,2)} = -4 + f(2,2) = -4 + 28 = 24

f(4,1) = INT_MIN
f(4,2) = 10 + max{f(3,1), f(2,1), f(1,1)} = 10 + f(2,1) = 10 + 23 = 33
f(4,3) = -20 + max{f(3,2), f(2,2), f(1,2)} = -20 + f(2,2) = -20 + 28 = 8

f(5,1) = INT_MIN
f(5,2) = INT_MIN
f(5,3) = 20 + max{f(4,2), f(3,2), f(2,2), f(1,2)} = 20 + f(4,2) = 20 + 33 = 53

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