Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
dp does the same as greedy!贪心一直没有想出来,不过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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator