mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
ddd34a4f1c
2000-2099
29 lines
555 B
C++
29 lines
555 B
C++
#include<stdio.h>
|
|
int main()
|
|
{
|
|
int t;
|
|
int a[101][101];
|
|
scanf("%d",&t);
|
|
while(t--){
|
|
int n;
|
|
scanf("%d",&n);
|
|
int i,j;
|
|
for(i=1;i<=n;i++)
|
|
{
|
|
for(j=1;j<=i;j++)
|
|
{
|
|
scanf("%d",&a[i][j]);
|
|
}
|
|
}
|
|
for(i=n-1;i>=1;i--)
|
|
{
|
|
for(j=1;j<=i;j++)
|
|
{
|
|
a[i][j]+=a[i+1][j]>a[i+1][j+1]?a[i+1][j]:a[i+1][j+1];
|
|
}
|
|
}
|
|
printf("%d\n",a[1][1]);
|
|
}
|
|
return 0;
|
|
}
|