HDU ACM 11 2084 数塔、水题

来源:互联网 发布:淘宝手淘搜索怎么增加 编辑:程序博客网 时间:2024/06/05 15:14
#include <iostream>#include <cmath>#include <algorithm>using namespace std;int Lu[1000][1000], Hui[1000];using namespace std;int main(){int n;int c;cin >> c;while (c--){cin >> n;for (int i = 1; i <= n; i++)for (int j = 1; j <= i; j++)cin >> Lu[i][j];for (int i = n; i >= 1; i--)for (int j = 1; j <= i; j++)Lu[i - 1][j] = max(Lu[i][j] + Lu[i - 1][j], Lu[i][j + 1] + Lu[i - 1][j]);cout << Lu[1][1] << endl;}return 0;}

0 0
原创粉丝点击