标签:sizeof class ++ algorithm typedef iostream using while clu
https://vjudge.net/contest/216347#problem/B
#include<iostream> #include<stdio.h> #include<string.h> #include<cmath> #include<math.h> #include<algorithm> typedef long long ll; using namespace std; int main() { int t; int a[105][105],dp[105][105]; scanf("%d",&t); while(t--) { memset(dp,0,sizeof(dp)); int n; scanf("%d",&n); for(int i=0;i<n;i++) { for(int j=0;j<=i;j++) { scanf("%d",&a[i][j]); } } for(int i=n-1;i>=0;i--) { for(int j=0;j<=i;j++) dp[i][j]=a[i][j]+max(dp[i+1][j],dp[i+1][j+1]); } printf("%d\n",dp[0][0]); } return 0; }
标签:sizeof class ++ algorithm typedef iostream using while clu
原文地址:https://www.cnblogs.com/caijiaming/p/9267412.html