Colored Sticks
Time Limit: 5000MS
Memory Limit: 128000K
Total Submissions: 31015
Accepted: 8180
Description
You are given a bunch of wooden sticks. Each endpoint of e...
分类:
其他好文 时间:
2014-10-22 01:09:19
阅读次数:
193
这题的思路是从书上看来的,不过好歹也弄明白原因了;注释清楚 方便以后看看.题意是 有若干 长度相同的棍子..英语水平有限,一开始没看懂,以为只有1根,要多多练习啊.. 1 #include 2 #include 3 #define maxn 70 4 using namespace std; 5 ....
分类:
其他好文 时间:
2014-10-10 15:22:50
阅读次数:
210
题意:有一个长为L的木棍,木棍中间有n个切点。每次切割的费用为当前木棍的长度。求切割木棍的最小费用。分析:d(i, j)表示切割第i个切点到第j个切点这段所需的最小费用。则有d(i, j) = min{d(i, k) + d(k, j)} + a[j] - a[i]; ( i 3 #include....
分类:
其他好文 时间:
2014-10-05 01:50:27
阅读次数:
380
题目链接:
http://poj.org/problem?id=2513
Colored Sticks
Time Limit: 5000MS
Memory Limit: 128000K
Total Submissions: 30955
Accepted: 8159
Description
You a...
分类:
其他好文 时间:
2014-10-03 13:05:24
阅读次数:
251
Two polar bears Menshykov and Uslada from the St.Petersburg zoo and elephant Horace from the Kiev zoo got six sticks to play with and assess the animals' creativity. Menshykov, Uslada and Horace decid...
分类:
其他好文 时间:
2014-09-28 10:50:23
阅读次数:
196
http://poj.org/problem?id=2513DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possibl...
分类:
其他好文 时间:
2014-09-22 22:49:43
阅读次数:
285
题目:求一个序列中最大不上升子序列的个数。
分析:dp,LIS。一个序列中的不上升子序列的最小个数,是他的最大上升子序列长度。
证明:首先求串的最大上升子序列,那么每个元素一定属于一个不同的不下降串;
如果,取第一个最大上升子序列,那么每个元素一定是集合中的最大值;
这些...
分类:
其他好文 时间:
2014-09-21 23:41:21
阅读次数:
321
题目:uva 10003 Cutting Sticks
题意:给出一根长度 l 的木棍,要截断从某些点,然后截断的花费是当前木棍的长度,求总的最小花费?
分析:典型的区间dp,其实和石子归并是一样的,花费就是石子的和,那么久不用多说了。
AC代码:
#include
#include
#include
#include
#include
#include
#in...
分类:
其他好文 时间:
2014-09-18 18:53:24
阅读次数:
201
题目:有一个长l的木头,切成n+1段,切割的代价是当前段长度,求最小代价和。
分析:dp,区间动态规划。石子合并的逆过程。
状态:设F(i,j)为从点i切到j长度的木头切割成对应的小段代价,则有转移方程:
F(i,j)= min(F(i,k)+F(k,j)+cost(i,j)) {其中 i
这里注意,dp过程按区间大小递...
分类:
其他好文 时间:
2014-09-15 11:20:48
阅读次数:
187
传送门Colored SticksTime Limit: 5000MSMemory Limit: 128000KDescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with...
分类:
其他好文 时间:
2014-09-14 20:34:57
阅读次数:
202