T607100 [USACO07OCT] Obstacle Course S
Description
Consider an N x N (1
Input Format
Line 1: A single integer: N
Lines 2..N + 1: Line i+1 represents row i of the field with N characters as above (i.e., '.', 'x', 'A', and 'B'); no spaces are present on a line
Output Format
Line 1: A single integer, the minimum number of turns the cow must make in a traversal
Explanation/Hint
只可以上下左右四个方向行走,并且不能走出这些格子之外。开始和结束时的方向可以任意。
### 数据范围及约定
对于全部数据,保证 $2\le N\le 100$。