DWITE Online Computer Programming Contest, January 2008, Problem 4
Sometimes an open field could be as much of a maze as narrow tunnels. Given an obstacle in an otherwise empty room, what is the shortest path around it?
The input file will contain five sets of data, each a
.
- empty space#
- wallX
- one of the ends
The output will contain five lines – each an integer distance between the two points marked with
There will always be only two
Sample Input
Copy
..........
..........
..........
....#.....
....#.....
X...#...X.
....#.....
....#.....
..........
..........
----------
..........
..........
........#.
........#.
X...#####X
...#......
..#.......
..........
..........
..........
----------
Sample Output
Copy
8
9
Problem Resource: DWITE
Comments
Why do I get Java array index out of bounds exception? Can someone help me out?
line 122, should be x + 1, not x - 1