
动态规划:背包
文章平均质量分 65
BRCOCOLI
初学者 记录成长 Fighting
展开
-
HDU 2955 Robberies 01背包 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2955算逃跑概率,并不是被抓住的概率相加因为风险是小数,所以不能表示进数组里,所以DP数组d[i]保存 抢到i元的最大逃跑概率 #include#include#include#include#includeusing namespace std;double d[10000+5原创 2016-09-17 00:24:53 · 213 阅读 · 0 评论 -
HDU 5887 Herbs Gathering 01背包+DFS搜索 *
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5887一开始想 100个物品 ,而且是随机的,分布均匀那么总的状态数不会太多吧就像用map试一下,结果MLE#include#include#include#include#include#includeusing namespace std;const int INF=1e9原创 2016-09-19 19:15:47 · 414 阅读 · 0 评论 -
HDU 1864 最大报销额 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1864题目很坑!!!是单类物品不能超出600#include#include#include#includeusing namespace std;double d[30+5];//前i个最大的报销额double P[3];int main(){ double MaxPr原创 2016-09-23 19:37:29 · 219 阅读 · 0 评论 -
HDU 2602 Bone Collector 01背包(裸) .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2602水的不行....#include#include#include#includeusing namespace std;const int maxn=1000+5;int d[maxn],w[maxn];// d[i]空间i下最大价值 int main(){ int T原创 2016-09-25 11:30:06 · 177 阅读 · 0 评论 -
HDU 1069 Monkey and Banana 完全背包+DP .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1069#include#include#include#includeusing namespace std;const int maxn=30+5;int rec[maxn][3],N;int d[maxn][3]; //d[idx][i] 以第idx的矩形为底边,i边为高的,摞最大原创 2016-09-25 13:19:00 · 241 阅读 · 0 评论 -
HDU 1171 Big Event in HDU 多重背包 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1171就是把总价值分成一半,求最多能放多少多重背包代码:842MS #include#include#include#includeusing namespace std;const int INF=0x3f3f3f3f;int v[50+5],n[50+5];bool原创 2016-09-25 18:05:01 · 270 阅读 · 0 评论 -
HDU 2191 珍惜现在,感恩生活 多重背包 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2191把我所知道的优化全部放上去了 0MS#include#include#include#includeusing namespace std;const int maxn=10000+5;int d[maxn];int main(){ int T; cin>>T; whi原创 2016-09-28 18:51:22 · 302 阅读 · 0 评论 -
HDU 1114 Piggy-Bank 完全背包 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1114#include#include#include#includeusing namespace std;const int maxn=10000+5;const int INF=0x3f3f3f3f;int d[maxn];int main(){ int T,lW,NW,W原创 2016-09-28 19:38:21 · 225 阅读 · 0 评论 -
HDU 1059 Dividing 多重背包 .
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1059二进制优化#include #include #include #include using namespace std;int num[7];bool d[80000+5];int main(int argc, char const *argv[]){ int kase原创 2016-10-02 16:12:15 · 249 阅读 · 0 评论