您的位置:首页 > 其它

HDOJ_ACM_悼念512汶川大地震遇难同胞——珍惜现在,感恩生活

2012-12-01 23:18 309 查看
[align=left]Problem Description[/align]
急!灾区的食物依然短缺!
为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。
请问:你用有限的资金最多能采购多少公斤粮食呢?

后记:
人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。
月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知数。那么,我们要做的就应该是珍惜现在,感恩生活——
感谢父母,他们给予我们生命,抚养我们成人;
感谢老师,他们授给我们知识,教我们做人
感谢朋友,他们让我们感受到世界的温暖;
感谢对手,他们令我们不断进取、努力。
同样,我们也要感谢痛苦与艰辛带给我们的财富~

View Code

[align=left]Key Points[/align]
[align=left]The first one is just using 0/1 knapsack, you can get the answer.[/align]
[align=left]For the second one , I classified the situations and dissicuss. the things which you will be confuse maybe the efficial 0/1 knapsack. [/align]
[align=left] [/align]
[align=left]Efficial 0/1 knapsack for the same things:[/align]
[align=left]for example, 7, it can be made up by 001 010 and 111. [/align]
[align=left]To begin with, make the 001 010 things into the bag, then rest packet is 3.[/align]
[align=left]Secondly, take the 3 things into the bag one by one.[/align]
[align=left]If you still fell confuse, you can draw it out. Maybe you will understand.[/align]
[align=left] [/align]

[align=left] [/align]

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐