#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 400;
short dp[MAX][MAX];
int main()
{
int n, i, j;
while (cin >> n){
for (i = 1; i <= n; i++){
for (j = 1; j <= i; j++){
cin >> dp[i][j];
}
}
for(i = n-1; i >= 1; i--){
for(j = 1; j <= i; j++)
dp[i][j] += max(dp[i+1][j],dp[i+1][j+1]);
}
cout << dp[1][1] << endl;
}
system("pause");
}
poj 3176 Cow Bowling
最新推荐文章于 2020-07-24 18:53:48 发布