22 人解决,35 人已尝试。
22 份提交通过,共有 63 份提交。
5.2 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
ALL HEADS: You’re a Knight of the Round Table?
ROBIN: I am.
LEFT HEAD: In that case I shall have to kill you.
MIDDLE HEAD: Shall I?
RIGHT HEAD: Oh, I don’t think so.
MIDDLE HEAD: Well, what do I think?
LEFT HEAD: I think kill him.
RIGHT HEAD: Well let’s be nice to him.
MIDDLE HEAD: Oh shut up.
As the story goes, the Knight scarpers off. Right Head has taken it upon himself to search the grounds for the knight so he, Left, and Middle can go extinguish him (and then have tea and biscuits.)
Consider the following 8 by 12 maze, where shaded squares are walls that can’t be entered.
The input file will consist of a single integer N (N > 0) specifying the number of mazes in the file. Following this, on a maze by maze basis will be the number of rows, r (3 < r <= 20), a space, then the number of columns, c (3 < c <= 20). After this will follow r lines of c characters, representing a map of the maze:
X’s mark those locations that are walls and can’t be occupied. S marks the start location, and F marks the Knight. Blanks are locations that can be freely traveled.
The output is the length of the shortest path between the start and finish locations. Based on the above maze, your program would output the minimum no-left-turns path length of 29.
Additional Constraints/Information:
◎Right Head is capable of moving from the start position in any of the four primary compass directions. After that, he’s constrained to either step forward or right.
◎The start and end locations will never be the same.
◎The maze is always surrounded by four walls.
◎You can assume that a path between the start and final locations always exists.
22 人解决,35 人已尝试。
22 份提交通过,共有 63 份提交。
5.2 EMB 奖励。
创建: 17 年前.
修改: 6 年,11 月前.
最后提交: 10 年,9 月前.
来源: N/A