Lang:G++
Edit123456789101112131415161718192021222324#include <cstdio>#include <algorithm>using namespace std;int award[100][100];int main(void){//层数int n, i, j;scanf("%d", &n);for (i = 0; i < n; ++i)for (j = 0; j <= i ; ++j)scanf("%d\n", &award[i][j]);n -= 2;while(n >= 0){for (i = 0; i <= n; ++i)award[n][i] += max(award[n+1][i], award[n+1][i+1]);--n;}printf("%d\n",award[0][0]);return 0;}