LikeMiracle @ 2024-03-08 21:04:30
#include<bits/stdc++.h>
using namespace std;
const int N=510;
int g[N][N];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++)
for(int j=0;j<=i;j++)
cin>>g[i][j];
for(int i=n-1;i>=0;i--){
for(int j=0;j<=i;j++)
g[i][j]+=max(g[i+1][j],g[i+1][j+1]);
}
cout<<g[0][0]<<endl;
return 0;
}
by syex_luoyukai @ 2024-03-08 21:06:42
把
by LikeMiracle @ 2024-03-08 21:08:36
@syex_luoyukai 谢谢大佬!AC了