HDOJ_ACM_Bone Collector
2012-11-20 16:09
375 查看
[align=left]Problem Description[/align] 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 trip of collecting there are a lot of bones , obviously , different bone has different value and different volume, now given the each bone’s value along his trip , can you calculate out the maximum of the total value the bone collector can get ? View Code | ||||||||||||||||||||||||||||
[align=left]Key Points[/align] [align=left]Firstly, you must realize it's a knapsack question. [/align] For those question, you should know the function f(n, v) = max(f(n - 1, v), f(n - 1, v - vol ) + value ). [align=left]f(n, v) means the greatest value of putting n things into knapsack whose volume is v.[/align] vol means the volume array. value means the value array. If you don't choose the nth thing, it's f(n - 1, v), if you chooose the nth thing, it's f(n - 1, v - vol ) plus the nth thing's value. [align=left]then the bigger answer is the f(n, v).[/align] [align=left]Of course, you can using form to deepen understanding.[/align] [align=left]For example, if you input those number as follows.[/align] [align=left]1[/align] [align=left]2 5[/align] [align=left]3 4[/align] [align=left]2 3[/align]
[align=left]Secondly, I provide simpler program.[/align] [align=left]If you understand the first kind, I think it's easy for you. [/align] [align=left]What I want to express is that the second circulation should begin with max, or you will be wrong. Because you put the same thing again.[/align] |
相关文章推荐
- HDOJ 2602 Bone Collector 杭电 ACM
- ACM贪心 HDOJ1050
- ACM--字母序列--HDOJ 1020--Encoding--字符串
- ACM--OJ判题--HDOJ 1073--Online Judge--字符串
- ACM--大数相加--HDOJ 1002--A + B Problem II
- ACM--字母个数--HDOJ 1860--统计字符--字符串
- HDOJ HDU 1709 The Balance ACM 1709 IN HDU
- HDOJ HDU 2079 选课时间 ACM 2079 IN HDU
- HDOJ 1181 HDU 1181 变形课 ACM 1181 IN HDU
- hdoj 2602 Bone Collector 【01-背包】
- HDOJ_ACM_母牛的故事
- ACM HDOJ 1063 (Exponentiation)
- ACM HDOJ 2063 (过山车)
- ACM HDOJ 2112 (HDU Today)
- 【ACM】HDOJ 1009 FatMouse' Trade
- HDOJ_ACM_steps——Buildings
- [HDOJ2602]Bone Collector(01背包)
- 渣渣ACM日记——1045-Fire Net (HDOJ)
- ACM HDOJ 下沙的沙子有几粒?
- [ACM] hdoj1042 N! 解题报告