1.6 饮料供货
1.6 饮料供货
基本问题
\[(S_i,V_i,C_i,H_i,B_i)
\]
\(S_i\):饮料的名称
\(V_i\):容量
\(C_i\):可能的最大数量,代表若仅够买某种饮料的最大可能数量,\(C_i = \frac{V}{V_i}\)
\(H_i\):用户对该饮料的满意度
\(B_i\):实际购买量
饮料的总容量:\(\sum_{i=0}^{n-1}(V_i * B_i)\)
总的满意度:\(\sum_{i=0}^{n-1}(H_i * B_i)\)
题目就转化成为:在饮料的总容量\(\sum_{i=0}^{n-1}(V_i * B_i) = V\)的情况下,求解 \(res = \arg\max{\sum_{i=0}^{n-1}(H_i * B_i)}\)
使用动态规划解题:
\(opt(V^{\prime},i)\)表示从\(0,1,...,i\)中饮料中,算出总容量为\(V^{\prime}\)的方案中满意度之和的最大值
\[opt(V^{\prime},i) = \max\{K*H_i + opt(V^{\prime} - V_i * K,i-1) \}, (K = 0,1,...,C_i , i = 0,1,...,n-1)
\]
Saying Less Doing More