【題目敘述】https://tioj.ck.tp.edu.tw/problems/2182
#include <bits/stdc++.h>
using namespace std;
int n, m, a[1005][1005], dp[1005][1005], ans = -1e9;
int main(){
cin >> n >> m;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
cin >> a[i][j];
}
}
for (int i = n-1; i >= 0; i--){
for (int j = m-1; j >= 0; j--){
dp[i][j] = max(dp[i+1][j], dp[i][j+1])+a[i][j];
ans = max(ans, dp[i][j]);
}
}
cout << ans << "\n";
}