一、题目描述 二、代码 import java.util.Scanner; public class Main { static int m, n; static int[][] map; static int[][] book; static int mid; //顺时针顺序 static int[][] order = { {0, 1}, {1, 0}, {0, -1}, {-1, 0} }; static int res; public static void main(String[] args) { Scanner in = new Scanner(System.in); m = in.nextInt(); n = in.nextInt(); map = new int[n][m]; book = new int[n][m]; res = Integer.MAX_VALUE; //计算所有数的和 int count = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ map[i][j] = in.nextInt(); count += map[i][j]; } } in.close(); //计算各个部分的和 mid = count / 2; book[0][0] = 1; dfs(0, 0, map[0][