思路

递归dp回溯
dp[i][j]+max(getMost(i-1,j),getMost(i,j-1)),状态转移方程

代码

import java.util.*;
public class Bonus {
    public int getMost(int[][] board,int i,int j) {
        // write code here
        if(i==0 && j==0){return board[0][0];}
        if(i==0){return board[i][j]+getMost(board,i,j-1);}
        if(j==0){return board[i][j]+getMost(board,i-1,j);}
        return board[i][j]+Math.max(getMost(board,i-1,j),getMost(board,i,j-1));
    }

    public int getMost(int[][] board) {
        // write code here
        return getMost(board,5,5);
    }   
}