从低端向上,每个结点取下一层左右结点最大值和本身价值相加,dp[0][0]为最后结果 #include<iostream> #include<algorithm> #include<cstdio> using namespace std; #define MAXN 510 typedef long long LL; LL a[MAXN][MAXN],dp[MAXN][MAXN]; LL sum = ,level; int main() { int i,j; scanf(…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2084 思路:要求从顶到底的最大值,可以反过来考虑,从底部向上. 只有下面一行的最大值确定,这一行的最大值才能确定. #include<iostream> #include<cstdio> #include<cstring> using namespace std; ; int a[maxn][maxn],dp[maxn][maxn],n; int main(void) {…