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 does the same as greedy!

Posted by Iambitious at 2006-11-20 10:41:59 on Problem 1700
In Reply To:dp does the same as greedy! Posted by:Iambitious at 2006-11-20 10:28:05
> 贪心一直没有想出来,不过dp也是O(n)的复杂度。
> best[i] = Math.min(best[i - 1] + data[0] + data[i], best[i - 2] + data[i] + 2 * data[1] + data[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