好牛的题 哈哈
#include <cstdio>
#include <algorithm>
#define S(n) scanf("%d",&n)
#define F(i,n) for(int i=1;i<=n;i++)
using std::max;int a[110][110],T,m,n,f;main(){S(T);F(b,T){m=0;S(n);F(i,n)F(j,i)S(f),m=max(m,a[i][j]=f+max(a[i-1][j],a[i-1][j-1]));printf("%d\n",m);}}