Digikey's DKC3 problems from 2011

I have this homework due not sure how to do it.




You are on an epic quest to save the Princess (and grab the treasure) who is locked in a tower (T). To get there, you will have to cross some combination of roads (R), which take one hour to cross; fields (F), which take 2 hours to cross; and moutanins (M), which take 3 hours to cross. Your program will have to determine the fastest route to the princess from your castle (C).

INPUT:
The test file will hold a square map as follows: The first line will contain an integer (N). The next N lines will contain a string of N characters: C, R, F, M, or T.

OUTPUT:
Your program should print the fastest route, and the time taken to to make your way from the castle to the Princess’s tower along the fastest route.

SAMPLE INPUT:
7
RTFMMMF
FMFMMMM
RRFFMRR
FRFFFMR
FRMMFFR
FFMMMMR
RRRCRRR

SAMPLE OUTPUT:
West, west, north, north, north, north, north.
10 hours to reach the Princess.
I would like (and others too I suppose) to see some code on wich you at least tryed to solve your homework.
cos no one will do a complete homewrok for you.
Last edited on
Topic archived. No new replies allowed.