随笔分类 - DP背包
摘要:链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2191 思路:多重背包模板题
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602
阅读全文
摘要:主要是打印路径有点麻烦,然后就是用于标记的数组要开大点,不然会狂wa不止,而且还不告诉你re
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1171思路:用一个数组将数据存起来,可以将其转化为01背包 1 #include 2 #include 3 #include 4 #include 5 #include 6 #inclu...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2159思路:二维完全背包,状态转移方程为: f[j][l]=max(f[j][l],f[j-b[i]][l-1]+w[i]); a[i]表示杀死第i个怪所得的经验值,b[i]表示消耗的忍耐度 1 #inc...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602思路:典型的01背包 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include...
阅读全文
摘要:题目链接:http://poj.org/problem?id=1837题目大意:有一个天平,左臂右臂各长15,然后给出n,m,n代表有几个挂钩,挂钩给出负数代表在左臂的距离,正数则在右臂m代表有m个砝码,要你求出使得这个天平保持平衡有几种方法,要求所有砝码全部使用完思路:首先我们先要明确dp数组的作...
阅读全文

浙公网安备 33010602011771号