Finding Nemo(图的广度遍历)

该博客介绍了如何解决一个迷宫问题,利用图的广度优先遍历策略寻找从起点(f1, f2)到(0, 0)的最短路径。迷宫由墙和门组成,墙会阻碍路径,门则允许通过。题目要求找到穿越最少门的路径。初始状态将所有位置设为墙,然后根据输入更新地图。使用优先队列进行搜索,若搜索到迷宫外部则输出0,表示无法到达目标位置。" 133082149,19681023,Java部署遇到模块找不到错误的解决方案,"['Java', '开发语言', '部署问题']
摘要由CSDN通过智能技术生成
Finding Nemo
Time Limit: 2000MS   Memory Limit: 30000K
Total Submissions: 9267   Accepted: 2192

Description

Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefore, he sent a signal to his father, Marlin, to ask for help.
After checking the map, Marlin found that the sea is like a labyrinth with walls and doors. All the walls are parallel to the X-axis or to the Y-axis. The thickness of the walls are assumed to be zero.
All the doors are opened on the walls and have a length of 1. Marlin cannot go through a wall unless there is a door on the wall. Because going through a door is dangerous (there may be some virulent medusas near the doors), Marlin wants to go through as few doors as he could to find Nemo.
Figure-1 shows an example of the labyrinth and the path Marlin went through to find Nemo.

We assume Marlin's initial position is at (0, 0). Given the position of Nemo and the configuration of walls and doors, please write a p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值