
背包
文章平均质量分 84
Algobird
这个作者很懒,什么都没留下…
展开
-
HDU 1864 最大报销额(dfs和01背包都可以)
最大报销额Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。 Input测试输入包含若干测试用例。每个测试用例的第1行包含原创 2015-02-04 16:49:44 · 484 阅读 · 0 评论 -
codeforces #546D# Soldier and Number Game(Dp,素数打表)
题目链接:http://codeforces.com/contest/546/problem/DTwo soldiers are playing a game. At the beginning first of them chooses a positive integern and gives it to the second soldier. Then the secon原创 2015-05-26 01:25:12 · 579 阅读 · 0 评论 -
hdu 1085 Holding Bin-Laden Captive!(多重背包or数学)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085给定1,2,5枚硬币个数,问最少不能凑到多少钱。先想到的是背包的解法。多重背包:#include using namespace std;int dp[8005];int value[4] = {1, 2, 5};int num[4];int cnt[8005];int原创 2015-06-23 19:24:56 · 808 阅读 · 0 评论 -
POJ 3260 The Fewest Coins(多重背包+完全背包)
DescriptionFarmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e原创 2015-02-14 12:54:44 · 539 阅读 · 0 评论 -
HDU 2955 Robberies(01背包变型)
DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work原创 2015-02-14 10:11:39 · 322 阅读 · 0 评论 -
UVA 624 CD(01背包输出)
DescriptionYou 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 tapeN minu原创 2015-02-14 09:58:54 · 466 阅读 · 0 评论 -
HDU 1712 ACboy needs your help(分组背包)
DescriptionACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrang原创 2015-02-13 21:46:19 · 480 阅读 · 0 评论 -
HDU 2546 饭卡(01背包)
Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。原创 2015-02-01 15:42:01 · 511 阅读 · 0 评论 -
POJ 2923 Relocation(状态压缩+01背包)
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2363 Accepted: 978DescriptionEmma and Eric are moving to their new house they bought after returning from their原创 2015-02-06 12:43:34 · 466 阅读 · 0 评论 -
hdu1114 Piggy-Bank(附装满背包初始化的理解)
Piggy-Bank Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)原创 2015-02-02 22:39:27 · 657 阅读 · 2 评论 -
HDU 2844 Coins(多重背包3种做法)
CoinsDescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watc原创 2015-02-04 14:33:15 · 647 阅读 · 1 评论 -
HDU 2639 Bone Collector II(01背包第k优解)
DescriptionThe title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't matter,原创 2015-02-01 22:22:57 · 688 阅读 · 0 评论 -
HDU 2602 Bone Collector(附01背包滚动数组的理解)
DescriptionMany 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 …原创 2015-02-01 14:59:47 · 802 阅读 · 1 评论 -
整数划分系列问题(动态规划)
今天上算法分析与设计课时,提到整数划分问题,但是因为之前没有很好地理解这一系列的问题。当被老师问到你们做算法的应该会这个问题吧,我当时也不太记得,但是只能硬头皮试着去写了下,用的是brute force,老师果断说我的方法跑不出正确的解,但是课堂上我也没有去解释了。课后自己验证了一下,没有问题,但是看了一下更好的动态规划的解法,顺便把几种整数划分的类型都理解清楚。原题:一个整数划分为多原创 2015-09-15 17:45:42 · 1134 阅读 · 0 评论