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

就是套着DP外衣的贪心啊

Posted by bsblcc at 2015-11-28 22:26:12 on Problem 2393
*mincost[i]为刚好通过i周的最小花费,mincost[i]=mincost[i-1]+produce[i][y[i]];
produce[i][y[i]]表示前i周生产y[i]单位酸奶并存储到第i周所需的最小花费
produce[i][y[i]]一定是从某一个周生产的;设为j周,produce[i][y[i]]=w[j]*y[i]+s*(i-j)*y[i]=y[i]*(w[j]+s*(i-j));
即问题在于寻找最小的(w[j]+s*(i-j))
发现这个式子与当前所在的周数无关(任取两周a,b.发现a优于b的不等式的成立与i无关),所以就比较之前最优的周和当前周就可以了
这个dp数组都没有必要,就是便于分析

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