DP水题 求从上到下走完,使所取得权值最小,并输出路径,若有多个满足,则输出靠右的 #include "stdio.h" #include "string.h" int inf=0x3f3f3f3f; struct node { int x,y; }dp[110][110]; int main() { int Case,ii,i,j,n,m,ans; int a[110][110]; scanf("%d",&Case); for (ii=…
Man Down Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2030 Accepted Submission(s): 743 Problem Description The Game “Man Down 100 floors” is an famous and interesting game.You can enjoy t…
题意: 给一个m*n的矩阵,每格上有一个数. 找从第1行到第m行的一条路径,使得这条路径上的数之和最小. 路径必须满足相邻两行所选的两个数的纵坐标相邻(即一个格子必须是另一个格子的周围八个格子中的一个) 输出每一行取的数的列值. 若有多个答案,则路径要求尽量靠右. 思路: 简单数塔DP.题比较不好读,不过可以分析样例. 代码: int T,m,n; int a[105][105], f[105][105]; int path[105]; int main(){ cin>>T; rep(t,1…
B - Monkey and Banana Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1069 Appoint description: Description A group of researchers are designing an experiment to test the IQ of a monkey. They wi…
G - FatMouse's Speed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description: Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4826 思路:dp[x][y][d]表示从方向到达点(x,y)所能得到的最大值,然后就是记忆化了. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define REP(i, a, b) for (int i = (a); i < (b); ++i)…