当前位置:网站首页>poj2935 Basic Wall Maze (2016xynu暑期集训检测 -----D题)
poj2935 Basic Wall Maze (2016xynu暑期集训检测 -----D题)
2022-08-05 10:26:00 【51CTO】
Description
In this problem you have to solve a very simple maze consisting of:
- a 6 by 6 grid of unit squares
- 3 walls of length between 1 and 6 which are placed either horizontally or vertically to separate squares
- one start and one end marker
A maze may look like this:
You have to find a shortest path between the square with the start marker and the square with the end marker. Only moves between adjacent grid squares are allowed; adjacent means that the grid squares share an edge and are not separated by a wall. It is not allowed to leave the grid.
Input
The input consists of several test cases. Each test case consists of five lines: The first line contains the column and row number of the square with the start marker, the second line the column and row number of the square with the end marker. The third, fourth and fifth lines specify the locations of the three walls. The location of a wall is specified by either the position of its left end point followed by the position of its right end point (in case of a horizontal wall) or the position of its upper end point followed by the position of its lower end point (in case of a vertical wall). The position of a wall end point is given as the distance from the left side of the grid followed by the distance from the upper side of the grid.
You may assume that the three walls don’t intersect with each other, although they may touch at some grid corner, and that the wall endpoints are on the grid. Moreover, there will always be a valid path from the start marker to the end marker. Note that the sample input specifies the maze from the picture above.
The last test case is followed by a line containing two zeros.
Output
For each test case print a description of a shortest path from the start marker to the end marker. The description should specify the direction of every move (‘N’ for up, ‘E’ for right, ‘S’ for down and ‘W’ for left).
There can be more than one shortest path, in this case you can print any of them.
Sample Input
1 6 2 6 0 0 1 0 1 5 1 6 1 5 3 5 0 0
Sample Output
NEEESWW
如果去掉障碍 那么就是一道dijkstra的最短路径 题
既然有了障碍 那么就处理障碍
把障碍相隔的两个点 设置为不能通过
剩下就是bfs了
边栏推荐
- 什么是 DevOps?看这一篇就够了!
- 【温度预警程序de开发】事件驱动模型实例运用
- Login function and logout function (St. Regis Takeaway)
- 开发常用手册链接分享
- Where is your most secretive personality?
- 单片机:温度控制DS18B20
- 公众号如何运维?公众号运维专业团队
- SQL外连接之交集、并集、差集查询
- Jenkins manual (2) - software configuration
- SMB + SMB2: Accessing shares return an error after prolonged idle period
猜你喜欢
STM32+ULN2003 drives 28BYJ4 stepper motor (forward and reverse according to the number of turns)
【 temperature warning program DE development 】 event driven model instance
three objects are arranged in a spherical shape around the circumference
PCB布局必知必会:教你正确地布设运算放大器的电路板
教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!
什么是 DevOps?看这一篇就够了!
FPGA:开发环境Vivado的使用
MySQL事务
单片机:温度控制DS18B20
How can project cost control help project success?
随机推荐
第四章:activiti流程中,变量的传递和获取流程变量 ,设置和获取多个流程变量,设置和获取局部流程变量「建议收藏」
19. Server-side session technology Session
如何选币与确定对应策略研究
First Decentralized Heist?Loss of nearly 200 million US dollars: analysis of the attack on the cross-chain bridge Nomad
Four years of weight loss record
静态链接和动态链接
[Strong Net Cup 2022] WP-UM
A small test of basic grammar, Go lang1.18 introductory refining tutorial, from Bai Ding to Hongru, basic grammar of go lang and the use of variables EP02
Development common manual link sharing
Our Web3 Entrepreneurship Project, Yellow
MySQL data view
力扣(LeetCode)216. 组合总和 III(2022.08.04)
SkiaSharp 之 WPF 自绘 投篮小游戏(案例版)
MySQL事务
如何测试一下现场的备机失败,转发主机的场景?
Data Middle Office Construction (10): Data Security Management
MySQL之数据视图
What is SPL?
Where is your most secretive personality?
JS introduction to reverse the recycling business network of learning, simple encryption mobile phone number