#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAX 350
int a[MAX][MAX];
int d[MAX][MAX];
int main()
{
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif
int n,i,j,k;
cin>>n;
for(i=0;i for(j=0;j<=i;j++)
cin>>a[i][j];
//dp initialize
for(i=0;i d[n-1][i] = a[n-1][i];
for(i=n-2;i>=0;i--)
for(j=0;j<=i;j++)
d[i][j]=a[i][j]+max(d[i+1][j],d[i+1][j+1]);
cout< return 0;
}
阅读(788) | 评论(0) | 转发(0) |