绕过障碍
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
在方格中,表示不能行走的格子,表示可以行走的格子。
卡门很胖,故而不好转弯。现在要从点走到点,请问最少要转度弯几次?
输入
第一行一个整数,
下面行,每行个字符,只出现字符:,表示上面所说的矩阵格子,每个字符后有一个空格。
输出
一个整数:最少转弯次数。如果不能到达,输出-1。
3
. x A
. . .
B x .
2
提示