
DP
骑马看骆驼a
这个作者很懒,什么都没留下…
展开
-
HDU-2084 数塔(简单DP)
Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100)...原创 2018-10-09 20:28:17 · 223 阅读 · 0 评论 -
HDU-1506 Largest Rectangle in a Histogram(单调栈,DP)
Largest Rectangle in a HistogramSample Input7 2 1 4 5 1 3 34 1000 1000 1000 10000Sample Output84000题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1506题意:求直方图中最大的矩形面积思路:有两种解法,个人感觉DP稍简单一点...原创 2018-11-25 20:48:09 · 397 阅读 · 0 评论 -
POJ-3186 Treats for the Cows(区间dp)
Treats for the CowsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8739Accepted: 4570DescriptionFJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get ...原创 2019-04-05 19:18:29 · 249 阅读 · 0 评论 -
POJ-1050 To the Max(最大子矩阵和)
To the MaxTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 54953Accepted: 29070DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is ...原创 2019-05-22 20:32:06 · 386 阅读 · 0 评论 -
最短Hamilton路径(二进制状态压缩+dp)
最短Hamilton路径给定一张 nn 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次。输入格式第一行输入整数n。接下来n行每行n个整数,其中第i行第j个整数表示点ii到jj的距离(记为a[i,j])。对于任意的x,y,z,数据保证 a[x,x]=0,a[x,...原创 2019-05-17 17:16:08 · 404 阅读 · 0 评论 -
POJ-2288 Islands and Bridges(二进制状态压缩+DP)
Islands and BridgesTime Limit: 4000MSMemory Limit: 65536KTotal Submissions: 13134Accepted: 3487DescriptionGiven a map of islands and bridges that connect these islands, a Hamilton pa...原创 2019-05-17 21:42:35 · 266 阅读 · 0 评论 -
2019上海网络赛(J)Stone gameDP背包
CSL loves stone games. He has n stones; each has a weight ai. CSL wants to get some stones. The rule is that the pile he gets should have a higher or equal total weight than the rest; however if he re...原创 2019-09-18 19:48:12 · 371 阅读 · 0 评论 -
2019沈阳网络赛(C)Dawn-K's water完全背包
Dawn-K recently discovered a very magical phenomenon in the supermarket of Northeastern University: The large package is not necessarily more expensive than the small package.On this day, Dawn-K came...原创 2019-09-21 21:26:33 · 376 阅读 · 0 评论