#include #include #include using namespace std; int main(){ int n; cin >> n; vector> tree(n); int temp; for(int i = 0;i> temp; tree[i].push_back(temp); } } vector> dp = tree; for(int i = n - 2;i >= 0;i--){ for(int j = i;j >= 0;j--){ dp[i][j] = max(dp[i + 1][j],dp[i + 1][j + 1]) + tree[i][j]; } } cout << dp[0][0]; return 0; }