dp dp[ i ] 表示第 i 个不选 , 前 i 个的选择合法的最小损失 , dp[ i ] = min( dp[ j ] ) ( max( 0 , i - 1 - k ) <= j <= i - 1 ) , 符合条件的 j 是一段连续的区间并且随着 i 的增大而增大 , 可以用单调队列维护 , ans = tot - min( dp[ k ] ) ( max( 0 , i - k ) <= k <= n ) ----------------------------------…
洛谷 P2616 [USACO10JAN]购买饲料II Buying Feed, II https://www.luogu.org/problemnew/show/P2616 题目描述 Farmer John needs to travel to town to pick up K (1 <= K <= 100) pounds of feed. Driving D miles with K pounds of feed in his truck costs D*K cents. The cou…