标签:
http://acm.hdu.edu.cn/showproblem.php?pid=2084
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 28668 Accepted Submission(s): 17230
#include<stdio.h> #include<string.h> #define max(a, b)(a > b ? a : b) #define N 110 int dp[N][N]; int main() { int t, n, i, j; scanf("%d", &t); while(t--) { scanf("%d", &n); for(i = 1 ; i <= n ; i++) for(j = 1 ; j <= i ; j++) scanf("%d", &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]); printf("%d\n", dp[1][1]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/qq2424260747/p/4785749.html