背包dp..--------------------------------------------------------------------------------#include#include#include#include#define rep( i , n ) for( int i ...
分类:
其他好文 时间:
2015-06-04 15:08:25
阅读次数:
147
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2546思路:需要首先处理一下的的01背包,当饭卡余额大于等于5时,是什么都能买的,所以题目要饭卡余额最小,那预留5元(相当于饭卡余额为5)来买最贵的菜然后对剩下n-1进行01背包dp才是正确的。但是还存在一个...
分类:
其他好文 时间:
2015-06-04 00:43:51
阅读次数:
140
题意:给一个n*m的矩阵,每个点是一个蛋糕的的重量,然后小明只能向右,向下走,求在不超过K千克的情况下,小明最终能吃得最大重量的蛋糕。思路:类似背包DP;状态转移方程:dp[i][j][k]----在i,j位置时,最大容量为k时的最大值;做背包循环一般从1开始,因为需要坐标-1的情况,从0开始需要特...
分类:
其他好文 时间:
2015-05-30 11:56:44
阅读次数:
126
Burnside/Polya+背包DP 这道题目是等价类计数裸题吧……>_> 题解:http://m.blog.csdn.net/blog/njlcazl_11109/8316340 啊其实重点还是:找出每个置换下的不动点数目 这道题比较特殊,牌的数量是限定的,所以只能DP来搞……(dp[R...
分类:
其他好文 时间:
2015-05-25 12:57:29
阅读次数:
140
DescriptionLet's remember one old joke:Once a gentleman said to another gentleman:— What if we play cards?— You know, I haven't played cards for ten y...
分类:
其他好文 时间:
2015-05-12 15:29:20
阅读次数:
175
题目传送门 1 /* 2 题意:n个程序员,每个人每行写a[i]个bug,现在写m行,最多出现b个bug,问可能的方案有几个 3 完全背包:dp[i][j][k] 表示i个人,j行,k个bug dp[0][0][0] = 1 表示不选择人的时候所有的bug的种类犯错误都只有一种...
分类:
其他好文 时间:
2015-05-08 21:39:09
阅读次数:
150
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 sma...
分类:
其他好文 时间:
2015-05-01 16:00:49
阅读次数:
165
DescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a lot and so he often buys coffee at coffee vending machines at motores...
分类:
其他好文 时间:
2015-04-29 23:00:16
阅读次数:
120
A和B做法和官方题解一样C题我是用背包+map,先把任务按最早開始的时间进行排序,然后去背包,dp[j]表示j时间能得到最大的得分,然后就过了。。代码:A:#include #include #include using namespace std;int n, b;char str[205];in...
分类:
其他好文 时间:
2015-04-29 21:09:27
阅读次数:
94
DescriptionWhen the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souvenirs to sell, and sometimes the travele...
分类:
其他好文 时间:
2015-04-26 15:12:47
阅读次数:
129