摘要: /** * 背包问题 * 有n件物品和一个最大承重为W的背包,每件物品的重量是w[i],价值是v[i], * 在保证总重量不超过 W 的前提下,选择某些物品装入背包,背包的最大总价值是多少? * 注意:每个物品只有一件,也就是每个物品只能选择 0 件或者 1 件 */ public class Ba 阅读全文
posted @ 2022-05-10 18:57 wjxuriel 阅读(26) 评论(0) 推荐(0)
摘要: public class Solution { //The entrance of program public static void main(String[] args) { int[] arr = new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int 阅读全文
posted @ 2022-05-10 18:39 wjxuriel 阅读(17) 评论(0) 推荐(0)