import java.util.*;
public class Bonus { public int getMost(int[][] board) { int row = board.length; int col = board[0].length; int[][] bonus = new int[row +1][col + 1]; bonus[1][1] = board[0][0]; for(int i = 2;i <= col;i++ ){ bonus[1][i] = bonus[1][i-1]+board[0][i-1]; } for(int i = 2;i <= row;i++ ){ bonus[i][1] = bonus[i-1][1]+board[i-1][0]; } for(int i = 2;i <= row;i ++){ for(int j = 2;j <= col;j++){ bonus[i][j] = Math.max(bonus[i-1][j],bonus[i][j-1]) + board[i-1][j -1]; } } return bonus[row][col];
}
}