摘要: Description Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her... 阅读全文
posted @ 2017-08-18 20:36 ACagain 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题意就是给出棍子的长度和n个切点,让你把它切成n+1段,每次切时花费价值为此时棍子的长度,问怎样切才能使最终花费最少。 区间dp,就是指一整段区间的最优值可以由其中几段小区间的最优值来决定,因此次类问题一般都是从小到大枚举区间的大小,然后再求每一个该大小的区间的最优值... 阅读全文
posted @ 2017-08-18 20:31 ACagain 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 题目:https://odzkskevi.qnssl.com/f85205c68ae5f131a579c799f71b7b69?v=1502173334 旅行商问题描述:平面上n个点,确定一条连接各点的最短闭合旅程。这个解的一般形式为NP的(在多项式时间内可以求出)J... 阅读全文
posted @ 2017-08-16 21:06 ACagain 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Problem Description It has recently been discovered how to run open-source software on the Y-Crate gaming device. A number of enterpri... 阅读全文
posted @ 2017-08-10 16:34 ACagain 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目:https://odzkskevi.qnssl.com/95fc8c37ba05359d81df6779e817c236?v=1501937229因为q很小,所以直接枚举所有的方案就行。 首先求不用方案时的最小生成树,然后每次枚举方案时只需考虑初次最小生成树中的... 阅读全文
posted @ 2017-08-10 10:46 ACagain 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 题目:https://odzkskevi.qnssl.com/8e16f8701018d0e3529ac3ca319e1f67?v=1502277241 最简单的kruskal,主要参考紫书代码 kruskal算法就是先给边按权值大小排序,然后从小到大遍历,用并查集判... 阅读全文
posted @ 2017-08-10 10:39 ACagain 阅读(79) 评论(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 阅读(85) 评论(0) 推荐(0) 编辑
摘要: Problem Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of p... 阅读全文
posted @ 2017-08-08 18:51 ACagain 阅读(98) 评论(0) 推荐(0) 编辑
摘要: DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. F... 阅读全文
posted @ 2017-08-08 17:53 ACagain 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 回文串是指aba、abba、cccbccc、aaaa这种左右对称的字符串。输入一个字符串Str,输出Str里最长回文子串的长度。Input 输入Str(Str的长度 #include #include #include using namespace std... 阅读全文
posted @ 2017-08-07 22:29 ACagain 阅读(82) 评论(0) 推荐(0) 编辑