Hdu2602 Bone Collector (01背包)】的更多相关文章

Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …The bone collector had a big bag with a volume of V ,and along his tri…
本文出自:http://blog.csdn.net/svitter 题意:典型到不能再典型的01背包.给了我一遍AC的快感. //============================================================================ // Name : 2602.cpp // Author : vit // Version : // Copyright : Your copyright notice // Description : Hello…
本文来源于:http://blog.csdn.net/svitter 题意:典型到不能再典型的01背包.给了我一遍AC的快感. //============================================================================ // Name : 2602.cpp // Author : vit // Version : // Copyright : Your copyright notice // Description : Hello…
2017-09-03 15:42:20 writer:pprp 01背包裸题,直接用一维阵列的做法就可以了 /* @theme: 01 背包问题 - 一维阵列 hdu 2602 @writer:pprp @begin:15:34 @end:15:42 @declare:最基本的01背包问题 POJ 3624 @error:最后取得是dp[M]不是 dp[M-1],然后注意数据范围dp的数据范围是M的范围 @date:2017/9/3 */ #include <iostream> #includ…
首先输入一个数字代表有n个样例 接下来的三行 第一行输入n  和  v,代表n块骨头,背包体积容量为v. 第二行输入n块骨头的价值 第三行输入n块骨头的体积 问可获得最大的价值为多少 核心:关键在于dp[j]=max(dp[j],dp[j-w[i]]+v[i]) 的状态转移!! 背包最多能装下题目中所给的骨头,如体积为10的背包能装下体积分别为5和4的体积一块, 但最后其实背包还剩余了体积为1的位置没有讨论,则通过 j-- 进行剩余补充讨论. 在体积不断减小的同事每次都对目前这个这个体积(目前状…
Bone Collector Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 21   Accepted Submission(s) : 6 Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collec…
Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 60469    Accepted Submission(s): 25209 Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bo…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …  The bone collect…
这种01背包的裸题,本来是不想写解题报告的.但是鉴于还没写过背包的解题报告.于是来一发. 这个真的是裸的01背包. 代码: #include <iostream> #include <cstdio> using namespace std; #define N 1007 int c[N],w[N],dp[N]; int main() { int t,i,n,V,v; scanf("%d",&t); while(t--) { scanf("%d%…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 这是做的第一道01背包的题目.题目的大意是有n个物品,体积为v的背包.不断的放入物品,当然物品有各自的体积和价值.在不超过总体积v的情况下,问能够达到的最大价值.并且物品是一个一个放入的.最后若有剩余的体积也不会填满. 刚开始是用贪心做的.将价值与体积的比值设定为一个值,即单位价值.然后按照单位价值排序,挨个取物品,考虑到了体积为0的情况,就将单位价值设定为无穷大.但是这样做并不能保证最优解.…