1015. 摘花生
模板dp
AC
# include <bits/stdc++.h>
using namespace std;
int f[200][200];
int main(){
int tt;cin>>tt;
while(tt--){
int n, m;
cin>>n>>m;
for(int i = 1; i <= n; i++ ){
for(int j = 1; j <= m; j ++ ){
cin>>f[i][j];
f[i][j]+=max(f[i-1][j],f[i][j-1]);
}
}
cout<<f[n][m]<<endl;
}
return 0;
}