![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
We got this problem yesterday. Our teacher said if we get it done before October he'll give us extra credit, but I don't really even know where to start. Just point me in the right direction por favor. Here's the problem:
Maze Surfing You dirty rat. You're caught in a malicious lab experiment, and dropped into a maze. Your job is to find the cheese and thereby to prove your superior intelligence of the various rodent sopecies. Program Input The input file PROG13.IN describes a single maze. The first line of the file is an integer, N, indicating the number of rows and columns in the maze, constrained by: 8 < N < 19. The next N lines each contain N characters seperated by spaces. Walls are represented by '#', hallways by '.', the start position by 'M' and the cheese by 'C'. Program Output The program should write the maze to PROG13.OUT, drawing the shortest path from M to C with a series of '+' characters. You may assume that (1) there will be a valid path from M to C, and (2) there will only be one path from M to C (i.e., no loops). The path is not permitted to contain any diagnol movements. Sample Input: 10 # # # # # # # # # # # . # M . . # . . # # . # # . # # # . # # . . . . . . . . # # # # # . # . # # # # . . . . # . # C # # # # # # # . # . # # . # . . . . # . # # . . . # . . . . # # # # # # # # # # # Sample Output: # # # # # # # # # # # . # M + . # . . # # . # # + # # # . # # . . . + + + . . # # # # # . # + # # # # . . . . # + # C # # # # # # # + # + # # . # . . . + # + # # . . . # . + + + # # # # # # # # # # #
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
| Bookmarks |