随笔分类 -  dp

摘要:D. Bear and Blocks time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Limak is a... 阅读全文
posted @ 2018-04-16 20:38 ACagain 阅读(110) 评论(0) 推荐(0)
摘要:C. Writing Code time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Programmers ... 阅读全文
posted @ 2018-02-06 22:36 ACagain 阅读(109) 评论(0) 推荐(0)
摘要:题意就是给出棍子的长度和n个切点,让你把它切成n+1段,每次切时花费价值为此时棍子的长度,问怎样切才能使最终花费最少。 区间dp,就是指一整段区间的最优值可以由其中几段小区间的最优值来决定,因此次类问题一般都是从小到大枚举区间的大小,然后再求每一个该大小的区间的最优值... 阅读全文
posted @ 2017-08-18 20:31 ACagain 阅读(79) 评论(0) 推荐(0)
摘要:题目:https://odzkskevi.qnssl.com/f85205c68ae5f131a579c799f71b7b69?v=1502173334 旅行商问题描述:平面上n个点,确定一条连接各点的最短闭合旅程。这个解的一般形式为NP的(在多项式时间内可以求出)J... 阅读全文
posted @ 2017-08-16 21:06 ACagain 阅读(161) 评论(0) 推荐(0)
摘要:A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = #include #in... 阅读全文
posted @ 2017-08-08 19:23 ACagain 阅读(87) 评论(0) 推荐(0)
摘要:多重背包可转化为01背包,首先将件数C二进制分解为多个件数的集合,这些件数可以组合成任意 小于等于C的数字,而且不会重复。 如7 7=111,可以分解为100,010,001,这三个数可以组合为任意小于等于7的数,而且每种组合都会得到不同的数。 13 13... 阅读全文
posted @ 2017-08-03 18:54 ACagain 阅读(81) 评论(0) 推荐(0)
摘要:51Nod - 1085题目: 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格... 阅读全文
posted @ 2017-06-20 14:35 ACagain 阅读(96) 评论(0) 推荐(0)
摘要:Description A numeric sequence of ai is ordered if a1 #include #include using namespace std;int num[1005],dp[1005];int main(){ int ... 阅读全文
posted @ 2017-06-05 23:58 ACagain 阅读(108) 评论(0) 推荐(0)
摘要:HDU 1069 Monkey and Banana(dp)A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana a... 阅读全文
posted @ 2017-05-31 22:36 ACagain 阅读(112) 评论(0) 推荐(0)