#这是枚举
```cpp
#include<iostream>
using namespace std;
int m,n;int inp[1000][1000];
int dfs(int depth,int place,int step){
if(depth==n)return step;
int a=dfs(depth+1,place,step+inp[depth][place]);
int b=dfs(depth+1,place+1,step+inp[depth][place]);
int c=dfs(depth+1,1,step+inp[depth][place]);
return(((a>b)?a:b)>c)?((a>b)?a:b):c;
}
int main(){
cin>>m>>n;
for(int i=0;i<n;i++){
for(int u=0;u<m;u++)cin>>inp[i][u];
}
cout<<dfs(0,0,0)+1;
}
```
by Erina @ 2017-07-03 19:49:15
这一题用数字三角形就可以吧
by 一念之间 @ 2017-07-13 10:11:20