纯个人整理,蓝桥杯使用的算法模板day2(0-1背包问题),手打个人理解注释,超全面,且均已验证成功(附带详细手写“模拟流程图”,全网首个设定 w e i g h t s = [ 2 , 3 , 4 , 5 ] weights=[2,3,4,5] weights=[2,3,4,5], v a l u e s = [ 3 , 4 , 5 , 6 ] values = [3,4,5,6] values=[3,4,5,6] 横轴: j j j(总背包容量);纵轴: i i i(第 i i i个物品); d p dp dp单元格:总背包价值