poj 2251 Dungeon Master 三维bfs
来源:互联网 发布:美工 编辑:程序博客网 时间:2024/05/16 06:06
Description
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid rock on all sides.
Is an escape possible? If yes, how long will it take?
Is an escape possible? If yes, how long will it take?
Input
The input consists of a number of dungeons. Each dungeon description starts with a line containing three integers L, R and C (all limited to 30 in size).
L is the number of levels making up the dungeon.
R and C are the number of rows and columns making up the plan of each level.
Then there will follow L blocks of R lines each containing C characters. Each character describes one cell of the dungeon. A cell full of rock is indicated by a '#' and empty cells are represented by a '.'. Your starting position is indicated by 'S' and the exit by the letter 'E'. There's a single blank line after each level. Input is terminated by three zeroes for L, R and C.
L is the number of levels making up the dungeon.
R and C are the number of rows and columns making up the plan of each level.
Then there will follow L blocks of R lines each containing C characters. Each character describes one cell of the dungeon. A cell full of rock is indicated by a '#' and empty cells are represented by a '.'. Your starting position is indicated by 'S' and the exit by the letter 'E'. There's a single blank line after each level. Input is terminated by three zeroes for L, R and C.
Output
Each maze generates one line of output. If it is possible to reach the exit, print a line of the form
where x is replaced by the shortest time it takes to escape.
If it is not possible to escape, print the line
Escaped in x minute(s).
where x is replaced by the shortest time it takes to escape.
If it is not possible to escape, print the line
Trapped!
Sample Input
3 4 5S.....###..##..###.#############.####...###########.#######E1 3 3S###E####0 0 0
Sample Output
Escaped in 11 minute(s).Trapped!题意:从S跑到E最短路径,可以往上下左右前后六个方向走。
思路:bfs。
代码:
。。。不在本机上,稍后补。。:)
0 0
- POJ 2251 Dungeon Master (三维BFS)
- POJ 2251:Dungeon Master(三维BFS)
- POJ 2251 Dungeon Master (三维迷宫 BFS)
- POJ 2251 Dungeon Master(三维BFS)
- poj 2251 Dungeon Master 三维bfs
- poj 2251 Dungeon Master(三维BFS)(中等)
- poj 2251 Dungeon Master(BFS三维)
- POJ 2251 Dungeon Master(三维bfs)
- POJ 2251 Dungeon Master(三维bfs)
- <三维BFS搜索> POJ 2251 Dungeon Master
- POJ 2251:Dungeon Master(三维BFS)
- POJ 2251 Dungeon Master(三维BFS)
- POJ 2251 Dungeon Master 三维BFS
- POJ 2251 Dungeon Master(三维bfs)
- POJ 2251 Dungeon Master (三维BFS)
- POJ 2251(WA)Dungeon Master(三维BFS)
- POJ.2251 Dungeon Master (三维BFS)
- poj 2251Dungeon Master(三维bfs)
- 哈弗曼树的创建编码及译码
- LCD选购指南
- 社説 20150722 米キューバ復交 独裁体制にどう改革を促すか
- Android中定时执行任务的3种实现方法
- LookupEdit作为Dev系统中常用的控件之一
- poj 2251 Dungeon Master 三维bfs
- python 两个序列随机移位
- Android Studio 快捷键的使用
- windows编程学习--网络编程学习--winsock编程(1)
- java_IO 读写文件,操作文件,控制台输入输出
- 系统基础信息模块
- Block
- 请问这是什么问题?用myeclipse自带的服务器代码运行正常,我jdk是1.8
- 社説 20150722 東芝会計操作 ルール軽視の企業風土改めよ