当前位置:网站首页>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了
边栏推荐
- The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?
- Voice-based social software development - making the most of its value
- SQL Outer Join Intersection, Union, Difference Query
- Four years of weight loss record
- Jenkins使用手册(2) —— 软件配置
- 皕杰报表的下拉框联动
- Open Source Summer | How OpenHarmony Query Device Type (eTS)
- MySQL transactions
- 【Office】Microsoft Office下载地址合集(微软官方原版离线安装下载)
- 数分面试(一)----与业务相关
猜你喜欢

教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!

RT-Thread记录(一、RT-Thread 版本、RT-Thread Studio开发环境 及 配合CubeMX开发快速上手)

012_SSS_ Improving Diffusion Model Efficiency Through Patching

linux下oracle常见操作以及日常积累知识点(函数、定时任务)

如何选币与确定对应策略研究

电竞、便捷、高效、安全,盘点OriginOS功能的关键词

Open Source Summer | How OpenHarmony Query Device Type (eTS)

Complete image segmentation efficiently based on MindSpore and realize Dice!

Huawei's lightweight neural network architecture GhostNet has been upgraded again, and G-GhostNet (IJCV22) has shown its talents on the GPU

In-depth understanding of timeout settings for Istio traffic management
随机推荐
Data Middle Office Construction (10): Data Security Management
语音社交软件开发——充分发挥其价值
第五章:activiti流程分流判断,判断走不同的任务节点
Egg framework usage (2)
Go compilation principle series 6 (type checking)
hcip BGP enhancement experiment
数分面试(一)----与业务相关
企业的数字化转型到底是否可以买来?
SQL外连接之交集、并集、差集查询
LeetCode 216. Combined Sum III (2022.08.04)
[Strong Net Cup 2022] WP-UM
气象数据数据处理实例——matlab字符串切割匹配与R语言日期匹配(数据拼接)
Is digital transformation a business buy-in?
还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!
60行从零开始自己动手写FutureTask是什么体验?
19. Server-side session technology Session
【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
Chapter 4: activiti RuntimeService settings get and get process variables, and the difference from taskService, set process variables when starting and completing tasks [easy to understand]
Jenkins使用手册(2) —— 软件配置
2022华数杯数学建模思路分析交流