![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Dymanic Programming
文章平均质量分 59
Lighting_
这个作者很懒,什么都没留下…
展开
-
uva 1625 color length
d[i][j] 表示拿了前i个和前j个后,还所需的“最少费用“。d[m][n] = 0;d[i][j] = res[i][j] + min(d[ i+1 ][ j ], d[ i ][ j+1 ] );计算res可以用一维的,因为每次都可以由前一个推算。代码#include int min(int i, int h) {return i<h?i:h;}int原创 2016-02-07 14:36:04 · 333 阅读 · 0 评论 -
UVA 1218 带状态判断的树形Dp
刘汝佳在书上说了状态转移方程, 嗯是三道题中较难的就动手写了一下。。发现有的状态是无效的, 就去看了刘汝佳的代码, 额使用极大值来表示。。这里也可以特殊判断(比如我) -----用IMPOSSIBLE表示不可能。AC代码。#include #include #include #include #include #define maxn 10010#define IMPO原创 2016-02-10 19:58:45 · 430 阅读 · 0 评论 -
poj 1112 uva1627
状态是前i个能凑到的与j最相近的数。/*test case152 3 5 01 4 5 3 01 2 5 01 2 3 04 3 2 1 0*/#include #include #include #include #include #include #define INF 100000000using namespace std;const int原创 2016-02-25 21:13:36 · 614 阅读 · 0 评论 -
halo world ))) uva 10934 droping water
纯思维题目啊。。。。最关键的是可以测到的楼梯的定义,有可能没用完就已经测到了。#include unsigned long long d[64],n,m,x,y;int main() { //freopen("out.txt","w",stdout); int k; while(scanf("%lld%lld",&n,&m) == 2 && n) { for(int i原创 2016-03-07 20:33:41 · 395 阅读 · 0 评论