首页 > 其他 > 详细

ZOJ - 3469 —— Food Delivery

时间:2016-03-28 15:09:26      阅读:204      评论:0      收藏:0      [点我收藏+]

题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3469

dp[i][j][0] := 派送区间[i,j]的用户并且最后派送 i 时的最小值 
dp[i][j][1] := 派送区间[i,j]的用户并且最后派送 j 时的最小值 
dp[i][j][0] = min(dp[i+1][j][0]+cost1, dp[i+1][j][1]+cost2)
dp[i][j][1] = min(dp[i][j-1][0]+cost3, dp[i][j-1][1]+cost4)

cost1 = (x[i+1]-x[i])*(sum[n]-sum[j]+sum[i])
cost2 = (x[j]-x[i+1])*(sum[n]-sum[j]+sum[i])
cost3 = (x[j]-x[i])*(sum[n]-sum[j-1]+sum[i-1])
cost4 = (x[j]-x[j-1])*(sum[n]-sum[j-1]+sum[i-1])

 

ZOJ - 3469 —— Food Delivery

原文:http://www.cnblogs.com/AcIsFun/p/5328936.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!