DP背包问题
five_east_west
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #672 (Div. 2) C1. Pokémon Army (easy version)
C1. Pokémon Army (easy version)DescriptionThis is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute a原创 2020-09-26 20:29:09 · 239 阅读 · 0 评论 -
牛客假日团队赛54 A-分组——dp
分组题目描述在Farmer John最喜欢的节日里,他想要给他的朋友们赠送一些礼物。由于他并不擅长包装礼物,他想要获得他的奶牛们的帮助。你可能能够想到,奶牛们本身也不是很擅长包装礼物,而Farmer John即将得到这一教训。Farmer John的N头奶牛(1≤N≤1041≤N≤10^41≤N≤104 )排成一行,方便起见依次编号为1…N。奶牛i的包装礼物的技能水平为si。她们的技能水平可能参差不齐,所以FJ决定把她的奶牛们分成小组。每一组可以包含任意不超过K头的连续的奶牛(1≤K≤1031≤K≤1原创 2020-09-20 09:25:40 · 130 阅读 · 0 评论 -
poj 3682 Bookshelf 2——背包问题(dfs)
Bookshelf 2DescriptionFarmer John recently bought another bookshelf for the cow library, but the shelf is getting filled up quite quickly, and now the only available space is at the top.FJ has N cows (1 ≤ N ≤ 20) each with some height of Hi (1 ≤ Hi ≤ 1,原创 2020-09-17 08:39:35 · 230 阅读 · 0 评论 -
poj 3624 Charm Bracelet-------普通01背包问题
Charm BraceletDescriptionBessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the supplied list has a weight Wi原创 2020-09-16 13:11:48 · 104 阅读 · 0 评论 -
poj 2576 Tug of War——背包问题
Tug of WarDescriptionA tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other; the number of people on the two teams must not differ by more原创 2020-09-16 10:44:16 · 782 阅读 · 2 评论 -
poj 1837 Balance——背包问题
BalanceDescriptionGigel has a strange “balance” and he wants to poise it. Actually, the device is different from any other ordinary balance.It orders two arms of negligible weight and each arm’s length is 15. Some hooks are attached to these arms and Gi原创 2020-09-16 00:07:54 · 290 阅读 · 0 评论 -
poj 1717 Dominoes(多米诺骨牌)——背包问题
DescriptionA domino is a flat, thumbsized tile, the face of which is divided into two squares, each left blank or bearing from one to six dots. There is a row of dominoes laid out on a table:The number of dots in the top line is 6+1+1+1=9 and the number转载 2020-09-14 18:34:29 · 284 阅读 · 0 评论 -
poj 1285 Combinations, Once Again——背包问题
Combinations, Once AgainDescriptionGiven n objects you’d have to tell how many different groups can be chosen if r objects are taken at a time.InputInput consists of less than 100 test cases. Each test case begins with two integers n (0 < n <= 50原创 2020-09-12 13:59:54 · 134 阅读 · 0 评论 -
P1273 有线电视网(树形dp + 背包问题)
题目描述某收费有线电视网计划转播一场重要的足球比赛。他们的转播网和用户终端构成一棵树状结构,这棵树的根结点位于足球比赛的现场,树叶为各个用户终端,其他中转站为该树的内部节点。从转播站到转播站以及从转播站到所有用户终端的信号传输费用都是已知的,一场转播的总费用等于传输信号的费用总和。现在每个用户都准备了一笔费用想观看这场精彩的足球比赛,有线电视网有权决定给哪些用户提供信号而不给哪些用户提供信号。写一个程序找出一个方案使得有线电视网在不亏本的情况下使观看转播的用户尽可能多。输入格式输入文件的第一行包原创 2020-07-24 10:49:31 · 456 阅读 · 0 评论 -
有依赖的背包问题——树形dp+背包问题(背包九讲)
有 NNN 个物品和一个容量是 VVV 的背包。物品之间具有依赖关系,且依赖关系组成一棵树的形状。如果选择一个物品,则必须选择它的父节点。如下图所示:如果选择物品5,则必须选择物品1和2。这是因为2是5的父节点,1是2的父节点。每件物品的编号是 i,体积是 vi,价值是 wi,依赖的父节点编号是 pi。物品的下标范围是 1…N1…N1…N。求解将哪些物品装入背包,可使物品总体积不超过背包容量,且总价值最大。输出最大价值。输入格式第一行有两个整数 NNN,VVV,用空格隔开,分别表示物品个数和原创 2020-07-22 11:32:53 · 855 阅读 · 0 评论