从 左上角到右下角,中间有*,X,Y,#字符,X,只能从左边到达,Y只能从右边到达,#不能到达。
public static int bfs() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
char[][] img = new char[n][m];
int[][] f = new int[n][m];
for (int i = 0; i < n; i++) {
Scanner ss = new Scanner(System.in);
String s = ss.nextLine();
for (int j = 0; j < m; j++) {
img[i][j] = s.charAt(j);
}
}
f[0][0] =1;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
if (img[i][j] == '#') {
f[i][j] = 0;
continue;
}else if ((i == 0 && j != 0) || img[i][j] == 'X