CCF___NOI @ 2024-10-18 20:26:12
#include<bits/stdc++.h>
using namespace std;
int vis[100002],n,k;
const int N=1007;
int a[N][N],dp[N][N];
int main(){
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
cin>>a[i][j];
for(int i=n-1;i>=1;i++){
for(int j=1;j<=i;j++){
a[i][j]=a[i][j]+max(a[i+1][j],a[i+1][j+1]);
}
}
cout<<a[1][1];
return 0;
}
by Towards_Dawn @ 2024-10-18 20:29:43
@CCF___NOI 《i++》
by Towards_Dawn @ 2024-10-18 20:30:28
@CCF___NOI i 倒着枚举要写 i--
by CCF___NOI @ 2024-10-18 20:52:49
@Towards_Dawn 拴Q