记忆化搜索
文章平均质量分 83
DOLFAMINGO
诗酒趁年华
展开
-
hdu1078 FatMouse and Cheese —— 记忆化搜索
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078代码如下:#include//hdu 1078 记忆化搜索#include#define MAX(a,b) (a>b?a:b)int n,k,dp[105][105],a[105][105];int dfs(int i,int j){ if(dp[i][j])原创 2017-03-03 19:38:46 · 271 阅读 · 0 评论 -
HDU3555 Bomb —— 数位DP
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555BombTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 18739 Accepted Submissi原创 2017-07-23 00:08:54 · 430 阅读 · 0 评论 -
Gym - 101147H H. Commandos —— DP
题目链接:http://codeforces.com/gym/101147/problem/H题解:单纯的三维DP。可用递推或记忆化搜索实现。学习:开始时用记忆化搜索写,dp[]初始化为0,结果一直走不出循环。后来发现:即使被搜过的位置,其值也可以是0,当再一次访问这个位置时,由于其值为0,就误以为这个位置没有搜过,于是再搜一遍。所以就不能用0来判断是否被搜索过。以后记忆化搜索原创 2017-04-20 22:44:03 · 367 阅读 · 0 评论 -
POJ3253 Round Numbers + HDU2089 不要62 —— 数位DP
POJ3253 :http://poj.org/problem?id=3252HDU2089:http://acm.hdu.edu.cn/showproblem.php?pid=2089数位DP:题目的一般形式为:求 [ L, R ] 范围内满足限制条件的值的个数。而 [ L, R ] = [ 0 , R ] - [ 0, L-1 ] ,所以做法就是分别求出 在R原创 2017-06-02 22:09:16 · 460 阅读 · 0 评论 -
UVA1025 A Spy in the Metro —— DP
题目链接: https://vjudge.net/problem/UVA-1025题解:详情请看紫书P267。递推:#include #include #include #include #include #include #include #include #include #include #include using namespace st原创 2017-05-01 22:50:36 · 282 阅读 · 0 评论 -
POJ1651 Multiplication Puzzle —— DP 最优矩阵链乘
题目链接:http://poj.org/problem?id=1651题解:……记忆化搜索:#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define p原创 2017-05-01 15:05:30 · 337 阅读 · 0 评论 -
Codeforces Round #178 (Div. 2) B. Shaass and Bookshelf —— DP
题解:http://codeforces.com/contest/294/problem/BB. Shaass and Bookshelftime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutput原创 2017-06-29 14:50:22 · 498 阅读 · 0 评论