![](https://img-blog.csdnimg.cn/20200414012859723.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
ICPC-DP背包问题
文章平均质量分 72
有关DP背包问题的题解
海岛Blog
专注于程序设计及其竞赛,专注于集成电路EDA设计
展开
-
HDU1284 钱币兑换问题【完全背包】
钱币兑换问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18088 Accepted Submission(s): 10838Problem Description在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对原创 2022-05-05 19:38:43 · 261 阅读 · 0 评论 -
HDU2189 来生一起走【完全背包】
来生一起走Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4668 Accepted Submission(s): 2411Problem Description妈妈你别哭泪光照亮不了我们的路让我们自己慢慢的走妈妈我会记住你和爸爸的模样记住我们的约定来生一起走上面这首诗节选自一位诗人纪念遇难同胞的作品,并没有华丽的语原创 2022-04-24 18:42:49 · 176 阅读 · 0 评论 -
HDU2191 珍惜现在,感恩生活【背包】
珍惜现在,感恩生活Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 52031 Accepted Submission(s): 22204Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其原创 2022-04-24 18:25:00 · 196 阅读 · 0 评论 -
UVA11003 Boxes【0-1背包】
We have some boxes numbered 1 to N. The dimensions of all boxes are identical. Now we have to stack up some of the boxes, subject to the following constraints:One cannot put more than one boxes directly upon a box;Boxes with lower serial numbers are not原创 2021-08-02 12:17:58 · 149 阅读 · 0 评论 -
UVA10616 Divisible Group Sums【组合+0-1背包】
Given a list of N numbers you will be allowed to choose any M of them. So you can choose in (NM)\tbinom{N}{M}(MN)ways. You will have to determine how many of these chosen groups have a sum, which is divisible by D.InputThe input file contains maximum te原创 2021-07-31 10:28:47 · 174 阅读 · 0 评论 -
UVA11450 Wedding shopping【DP】
One of our best friends is getting married and we all are nervous because he is the first of us who is doing something similar. In fact, we have never assisted to a wedding, so we have no clothes or accessories, and to solve the problem we are going to a f原创 2021-06-24 17:33:32 · 235 阅读 · 0 评论 -
HDU1881 毕业bg【0-1背包】
毕业bgTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6346 Accepted Submission(s): 2370Problem Description每年毕业的季节都会有大量毕业生发起狂欢,好朋友们相约吃散伙饭,网络上称为“bg”。参加不同团体的bg会有不同的感觉,我们可以用一个非负整数为每个bg定义一个“快乐度”。现给定一个原创 2021-05-22 21:58:01 · 218 阅读 · 0 评论 -
UVA10154 Weights and Measures【0-1背包】
I know, up on top you are seeing great sights,But down at the bottom, we, too, should have rights.We turtles can’t stand it. Our shells will all crack!Besides, we need food. We are starving!” groaned Mack. Mack, in an effort to a原创 2021-05-06 00:13:58 · 195 阅读 · 0 评论 -
HDU2546 饭卡【贪心+0-1背包】
饭卡Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 61781 Accepted Submission(s): 21084Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即原创 2021-04-12 05:38:22 · 353 阅读 · 0 评论 -
UVA624 CD【0-1背包】
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N minutes long. How to choose tracks from CD to get most out of tape space a原创 2021-02-22 20:03:08 · 195 阅读 · 0 评论 -
HDU1864 最大报销额【0-1背包】
最大报销额Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 37898 Accepted Submission(s): 11690Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超原创 2020-08-16 21:36:33 · 408 阅读 · 0 评论 -
UVA10313 Pay the Price【完全背包+Coin Change+DP】
In ancient days there was a country whose people had very interesting habits. Some of them were lazy, some were very rich, some were very poor and some were miser. Obviously, some of the rich were mis...原创 2020-04-23 17:25:02 · 339 阅读 · 0 评论 -
HDU2069 Coin Change【0-1背包+Coin Change+DP】
Coin ChangeTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 29605 Accepted Submission(s): 10543Problem DescriptionSuppose there are 5 type...原创 2020-04-23 10:58:24 · 443 阅读 · 0 评论 -
UVA1213 LA3619 POJ3132 ZOJ2822 Sum of Different Primes【筛选法+0-1背包】
A positive integer may be expressed as a sum of different prime numbers (primes), in one way or another. Given two positive integers n and k, you should count the number of ways to express n as a sum ...原创 2020-04-21 21:18:15 · 332 阅读 · 0 评论 -
UVA990 Diving for Gold【0-1背包】
John is a diver and a treasure hunter. He has just found the location of a pirate ship full of treasures. The sofisticated sonar system on board his ship allows him to identify the location, depth and...原创 2020-04-21 18:30:04 · 412 阅读 · 0 评论 -
HDU2660 Accepted Necklace【0-1背包】
Accepted NecklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5018 Accepted Submission(s): 1979Problem DescriptionI have N precious st...原创 2020-03-21 11:43:51 · 274 阅读 · 0 评论 -
UVA11900 Boiled Eggs【0-1背包】
Three of the trouble-makers went to Malaysia this year. A rest house was booked for them. Unlike other rest houses, this rest house was like a normal duplex house. So, it had a kitchen. And the troubl...原创 2020-03-08 12:35:49 · 315 阅读 · 1 评论 -
UVA10130 SuperSale【0-1背包】
There is a SuperSale in a SuperHiperMarket. Every person can take only one object of each kind, i.e. one TV, one carrot, but for extra low price. We are going with a whole family to that SuperHiperMar...原创 2020-03-02 22:37:01 · 361 阅读 · 0 评论 -
HDU2602 Bone Collector【0/1背包+DP】
Bone Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 72742 Accepted Submission(s): 30265 Problem DescriptionMany y...原创 2018-02-10 22:34:56 · 500 阅读 · 0 评论 -
UVA674 Coin Change【0/1背包+DP】
Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to makechanges with these coins for a given amount of money. For example, if we have 11 cents, then we can...原创 2018-02-06 08:04:43 · 638 阅读 · 0 评论 -
UVA147 Dollars【0/1背包+DP】
New Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5ccoins. Write a program that will determine, for any given amount, in how many ways that amountmay be ...原创 2018-02-06 07:13:44 · 570 阅读 · 0 评论 -
HDU1248 寒冰王座【0/1背包+DP】
寒冰王座Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20946 Accepted Submission(s): 10907 Problem Description不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(...原创 2018-08-17 19:41:30 · 877 阅读 · 1 评论 -
UVA357 LA5251 Let Me Count The Ways【0/1背包】
After making a purchase at a large department store, Mel’s change was 17 cents. He received 1 dime, 1 nickel, and 2 pennies. Later that day, he was shopping at a convenience store. Again his change wa...原创 2019-02-15 08:50:40 · 400 阅读 · 0 评论 -
UVALive5583 UVA562 Dividing coins【0/1背包+DP】
It’s commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting overa nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce,they ...原创 2016-08-13 11:32:42 · 864 阅读 · 0 评论