一道 flood fill.
如果你WA了, 那么请注意: 这个迷宫可能不通, 要两头搜.
给点测试数据(Discuss上的)
3
...
###
...
Answer is 1085
..#..
..#..
#####
..#..
..#..
Answer is 108
And there's a BIG TEST
33
............#........#....##.....
....#..##.........#.....##..#....
.....#.##....#...........#.#####.
#..###.....#..............#.....#
......##......#.##..#.....#.....#
###.##.#.........##.#.....#.#.#..
..#..#.##......#.###.#.....#.###.
##.......##....#.#..##.##.#.#....
....##.....#.............#..#....
#...###.###......#..#..#.....###.
##......##..#..#....#......###...
.#...#.#..#######..#..####.......
....##.#.........##....##........
.......#...#......#....###....#.#
....#.#.........#.#..##......#...
#..##..#...#.#..#.#####..##....#.
#.....#......#.#..##.#...#.###...
..........#...#..##....##...#...#
..##.#..#...#..#..##............#
...........#..#.#.#....#.....##..
#.#.#...####..#...#..#....#.#....
.#.....#.#.......##.#.#.#...##.#.
..#..##....#.................#..#
.......#..#.###......#.....#.....
.#.......#.....#.....#...........
....#.####......#....###.........
.#.#.##.#.....##..##........#.##.
..#......#.#.##....#......#.#....
#..........##....#.#..#####.#....
.....#..#.#.....###.....#...#....
#..........#..#.#...##........#..
.......#....#..#.........#.......
.....#..#.......##.##..#.........
ANSWER 7812