随笔分类 -  dp——背包问题

摘要:#include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace std; const int M=2e5+7; int read(){ int ans=0,f=1,c=getcha 阅读全文
posted @ 2019-11-16 14:56 友人Aqwq 阅读(169) 评论(0) 推荐(0)
摘要:Polycarp is in really serious trouble — his house is on fire! It's time to save the most valuable items. Polycarp estimated that it would take tisecon 阅读全文
posted @ 2017-09-26 08:12 友人Aqwq 阅读(234) 评论(0) 推荐(0)
摘要:有N种物品,每种物品的数量为C1,C2......Cn。从中任选若干件放在容量为W的背包里,每种物品的体积为W1,W2......Wn(Wi为整数),与之相对应的价值为P1,P2......Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格隔开。N为物品的 阅读全文
posted @ 2017-08-19 00:05 友人Aqwq 阅读(258) 评论(0) 推荐(0)