
dp问题
文章平均质量分 71
yzrefueling
内心的充盈远重于外表的浮华
展开
-
dp问题 插花
You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glu原创 2017-04-04 11:22:06 · 575 阅读 · 0 评论 -
dp问题 添加最少的字符构成回文串
A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal numb原创 2017-04-04 11:25:29 · 813 阅读 · 0 评论 -
dp问题 求连续序列的最大和
Given a sequence a11,a22,a33......ann, your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe fi原创 2017-04-04 11:10:09 · 319 阅读 · 0 评论 -
树状dp Tree of Tree
You're given a tree with weights of each node, you need to find the maximum subtree of specified size of this tree.Tree Definition A tree is a connected graph which contains no cycles.原创 2017-04-06 17:27:35 · 667 阅读 · 0 评论 -
树状dp Anniversary party
#include#include#include#include#include using namespace std;const int MAXN=6005;vector tree[MAXN]; int n,r,maxn;int value[MAXN];int root[MAXN];int dp[MAXN][2]; //dp[i][0]代表第i个人不来 dp[i]原创 2017-04-06 17:17:53 · 386 阅读 · 0 评论 -
dp问题 滑雪
Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 8原创 2017-04-04 11:12:13 · 343 阅读 · 0 评论 -
Dollar Dayz POJ - 3181 动态规划 完全背包
Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer John has exactly原创 2017-04-25 10:55:00 · 492 阅读 · 0 评论 -
宁波市第32届中小学生程序设计竞赛(初中组) 母鸡下蛋
问题 C: 母鸡下蛋鸡国中的母鸡最擅长下蛋了,MGMG 是鸡国中一只以下蛋产量高而闻名全鸡国的母鸡。 鸡国专供下蛋的 n 个鸡窝呈一字排列在鸡国的“下蛋中心”,从左到右依次编号为 1 到n。每个鸡窝都有一个最大可下蛋的量,其中第 i 个鸡窝的最大可下蛋量为 ci 。有时候由于MGMG 产量实在太大而无法在一个鸡窝中下完所有的蛋,不得不转移到隔壁的鸡窝继续下蛋,如果隔壁的鸡窝还是不能让它原创 2017-07-25 18:14:07 · 1846 阅读 · 2 评论 -
宁波市第31届中小学程序设计比赛模拟试题 【动态规划】cirs
题目描述Czyzoiers 都想知道小 x 为什么对鸡蛋饼情有独钟。经过一番逼问,小 x 道出了实情:因为他喜欢圆。最近小 x 又发现了一个关于圆的有趣的问题:在圆上有2N 个不同的点,小 x 想用 N 条线段把这些点连接起来(每个点只能连一条线段),使所有的线段都不想交,他想知道这样的连接方案有多少种?输入有且仅有一个正整数 N(N≤3000)。输出要求的原创 2017-07-25 18:26:37 · 777 阅读 · 0 评论