09 2017 档案

摘要:链接 分析:来看看背包九讲里面的一段话: 对于一个给定了背包容量、物品费用、物品间相互关系(分组、依赖等) 的背包问题,除了再给定每个物品的价值后求可得到的最大价值外,还可以得 到装满背包或将背包装至某一指定容量的方案总数。对于这类改变问法的问题,一般只需将状态转移方程中的max改成sum即可。例如 阅读全文
posted @ 2017-09-30 00:02 wolf940509 阅读(172) 评论(0) 推荐(0)
摘要:链接 分析:dp[i][j]表示前i个数,组成j,最少需要多少个。dp[i][j]=min(dp[i-1][j],dp[i-1][j-k*v[i]]+k),则可以转化为完全背包问题,同样的方法进行降维处理即可。 1 #include "iostream" 2 #include "cstdio" 3 阅读全文
posted @ 2017-09-25 21:56 wolf940509 阅读(184) 评论(0) 推荐(0)
摘要:链接 分析:裸的完全背包问题 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 const int maxn=1e5+100; 7 i 阅读全文
posted @ 2017-09-25 10:58 wolf940509 阅读(183) 评论(0) 推荐(0)
摘要:51Nod1086 分析:二进制优化多重背包,推荐一篇不错的blog,点我 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 cons 阅读全文
posted @ 2017-09-21 16:18 wolf940509 阅读(105) 评论(0) 推荐(0)
摘要:A题 分析:暴力 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 const int maxn=100+10; 7 int vis[ 阅读全文
posted @ 2017-09-14 22:04 wolf940509 阅读(173) 评论(0) 推荐(0)
摘要:Little Chef and Sums 分析:水题,去维护一下前缀和以及后缀和就好,注意long long 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using name 阅读全文
posted @ 2017-09-08 10:19 wolf940509 阅读(177) 评论(0) 推荐(0)