动态规划
MasterSPP
这个作者很懒,什么都没留下…
展开
-
滑雪
输入 5 5 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 输出 25 原题链接:P1434 [SHOI2002]滑雪 采用记忆化搜索 以下是C代码 #include <stdio.h> #include<stdlib.h> #include<math.h> int dx[4] = { 0,0,1,-1 }; int dy[4] = { 1,-1,0,0 }; int n, m.原创 2021-04-12 00:07:38 · 63 阅读 · 0 评论 -
数字金字塔—动态规划
思路:使用动态规划自底向上运算 状态转换方程:f[i][j] = max{ f[i+1][j], f[i+1][j+1] } + a[i][j] 如果题目数据中金字塔的行数太多,可以使用register,提高读写速度,也就是代码里注释掉的部分 输入 5 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 输出 30 以下是C代码 #include <stdio.h> #include<stdlib.h> #include<math.h> //#includ原创 2021-04-11 11:27:21 · 417 阅读 · 0 评论