
dp
文章平均质量分 56
ACagain
这个作者很懒,什么都没留下…
展开
-
HDU 1069 Monkey and Banana(dp)
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 at the roof of a building, and at the mean time, provide the monkey原创 2017-05-31 22:35:34 · 176 阅读 · 0 评论 -
POJ2533Longest Ordered Subsequence(LIS)
Description A numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence (a1, a2, …, aN) be any sequence (ai1, ai2, …, aiK), where 1 <= i1 < i2 < … < iK <原创 2017-06-05 23:57:54 · 197 阅读 · 0 评论 -
01背包及完全背包问题(51Nod - 1085,HDU 1114 Piggy-Bank)
51Nod - 1085题目: 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格隔开。N为物品的数量,W为背包的容量。(1 <= N <= 100,1 <= W <= 10000) 第2 - N +原创 2017-06-20 14:35:00 · 371 阅读 · 0 评论 -
LCS Common Subsequence
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = #include <iostream>#include <algorithm>#include <cstring>using namespace std原创 2017-08-08 19:23:15 · 244 阅读 · 0 评论 -
双调欧几里得旅行商问题 UVA 1347 Tour
题目:https://odzkskevi.qnssl.com/f85205c68ae5f131a579c799f71b7b69?v=1502173334 旅行商问题描述:平面上n个点,确定一条连接各点的最短闭合旅程。这个解的一般形式为NP的(在多项式时间内可以求出)J.L. Bentley 建议通过只考虑双调旅程(bitonictour)来简化问题,这种旅程即为从最左点开始,严格地从左到右直至最右原创 2017-08-16 21:06:20 · 229 阅读 · 0 评论 -
区间dp uva 10003 - Cutting Sticks
题意就是给出棍子的长度和n个切点,让你把它切成n+1段,每次切时花费价值为此时棍子的长度,问怎样切才能使最终花费最少。 区间dp,就是指一整段区间的最优值可以由其中几段小区间的最优值来决定,因此次类问题一般都是从小到大枚举区间的大小,然后再求每一个该大小的区间的最优值,最终得到整个区间的最优值。#include<iostream>#include <algorithm>#include <cs原创 2017-08-18 20:30:31 · 247 阅读 · 0 评论 -
多重背包 HDU 2844 Coins
多重背包可转化为01背包,首先将件数C二进制分解为多个件数的集合,这些件数可以组合成任意 小于等于C的数字,而且不会重复。 如7 7=111,可以分解为100,010,001,这三个数可以组合为任意小于等于7的数,而且每种组合都会得到不同的数。 13 13=1101,可以分解为0001,0010,0100,0110,前三个数可以组合成7以内的任意数,加上6就可以组合为任意大于6小于等原创 2017-08-03 18:54:12 · 242 阅读 · 0 评论 -
完全背包 cf302div2 C
C. Writing Code time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Programmers working on a large project have just received a task to write原创 2018-02-06 22:36:00 · 236 阅读 · 0 评论 -
Codeforces Round #318 D. Bear and Blocks
D. Bear and Blocks time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Limak is a little bear who loves to play. Today he is playing by destro...原创 2018-04-16 20:37:38 · 220 阅读 · 0 评论