标签:class -- for 递推 三角形 记忆化 lov love max
int solve(int i,int j)
{
return a[i][j]+(i==n?0:max(solve(i+1,j),slove(i+1,j+1)));
}
int i,j;
for (j=1;j<=n;j++)
d[n][j]=a[n][j];
for (i=n-1;i>=1;i--)
for (j=1;j<=i;j++)
d[i][j]=a[i][j]+max(d[i+1][j],d[i+1][j+1]);
int solve(int i,int j)
{
if (d[i][j]>=0)
return d[i][j];
return d[i][j]=a[i][j]+(i==n?0:max(solve(i+1,j),slove(i+1,j+1)));
}
标签:class -- for 递推 三角形 记忆化 lov love max
原文地址:https://www.cnblogs.com/yujh01/p/10335404.html