cannotdp @ 2022-01-20 09:56:05
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int a[1005][1005];
int ans;
void dfs(int x,int y,int sum){
if(x==n){
ans=max(ans,sum);
return;
}
dfs(x+1,y,sum+a[x+1][y]);
dfs(x+1,y+1,sum+a[x+1][y+1]);
}
int main(){
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
cin>>a[i][j];
dfs(1,1,0);
cout<<ans;
return 0;
}
by cannotdp @ 2022-01-20 10:11:46
@abruce 好的谢谢,现在是一个标准的暴搜了,拿了55,我要开始剪枝了
by _k_e_v_i_n_ @ 2022-02-26 18:52:59
@十年OI一场空 爆搜超时,因为