0x52 背包
背包是线性DP中一类重要而特殊的模型。
1. 0/1背包
0/1背包问题的模型如下: 给定 N N N个物品,其中第 i i i个物品的体积为 V i V_i Vi,价值为 W i W_i Wi。有一个容积为 M M M的背包,要求选择一些物品放入背包&…
【等差数列 ⟹ \Longrightarrow ⟹ 通项公式: a n a 1 ( n − 1 ) d a m ( n − m ) d n d a 1 − d A n B a_n a_1(n-1)d a_m(n-m)dnda_1-dAnB ana1(n−1)dam(n−m)dnda1−dAnB ⟹ \Longrightarrow ⟹ A d , B a 1 − d Ad&#x…