ufnrixhuyedw @ 2022-08-24 21:06:41
https://www.luogu.com.cn/paste/8nza6trw
by seanlsy @ 2022-08-24 21:24:02
输入炸了
by ufnrixhuyedw @ 2022-08-24 21:25:03
@seanlsy 改成.....
by seanlsy @ 2022-08-24 21:25:58
@ufnrixhuyedw
```cpp
#include<bits/stdc++.h>
#define maxn 1005
using namespace std;
int n,a[maxn][maxn];
int l;
int r;
int main(){
int n;
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++){
l=a[i][j]+a[i+1][j];
r=a[i][j]+a[i+1][j+1];
if(l>r)
a[i][j]=l;
else
a[i][j]=r;
}
}
cout<<a[1][1];
return 0;
}
by zhou_reset_qihao @ 2022-08-24 21:26:19
#include<bits/stdc++.h>
#define maxn 1005
using namespace std;
int n,a[maxn][maxn];
int l;
int r;
int main(){
int n;
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++){
l=a[i][j]+a[i+1][j+1];
r=a[i][j]+a[i+1][j];
if(l>r)
a[i][j]=l;
else
a[i][j]=r;
}
}
cout<<a[1][1];
return 0;
}
by ufnrixhuyedw @ 2022-08-24 21:31:41
@seanlsy 谢啦!!☆⌒(*^-゜)v
by ufnrixhuyedw @ 2022-08-24 21:32:09
@ZhouQiHao123 谢啦!!☆⌒(*^-゜)v
by Ly_boy @ 2022-08-25 13:32:56
就看完你的dp之后,说不上来的别扭