当前位置:网站首页>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了
边栏推荐
- 第七章,activiti个人任务分配,动态指定和监听器指定任务委派人「建议收藏」
- 【综合类型第 35 篇】程序员的七夕浪漫时刻
- Score interview (1)----related to business
- 你最隐秘的性格在哪?
- 第八章:activiti多用户任务分配
- 用户考试分数大于单科科目平均分的查询
- 机器学习-基础知识 - Precision, Recall, Sensitivity, Specificity, Accuracy, FNR, FPR, TPR, TNR, F1 Score, Bal
- Complete image segmentation efficiently based on MindSpore and realize Dice!
- High-quality DeFi application building guide to help developers enjoy DeFi Summer
- Our Web3 Entrepreneurship Project, Yellow
猜你喜欢

What is SPL?

Data Middle Office Construction (10): Data Security Management

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

The host computer develops C# language: simulates the STC serial port assistant to receive the data sent by the microcontroller

基于MindSpore高效完成图像分割,实现Dice!

Common operations of oracle under linux and daily accumulation of knowledge points (functions, timed tasks)

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

Create a Dapp, why choose Polkadot?

PCB布局必知必会:教你正确地布设运算放大器的电路板

阿里顶级架构师多年总结的JVM宝典,哪里不会查哪里!
随机推荐
Is digital transformation a business buy-in?
PHP 操作mangoDb
创建一个 Dapp,为什么要选择波卡?
第八章:activiti多用户任务分配
three.js debugging tool dat.gui use
uniapp connect ibeacon
用KUSTO查询语句(KQL)在Azure Data Explorer Database上查询LOG实战
第五章:redis持久化,包括rdb和aof两种方式[通俗易懂]
linux下oracle常见操作以及日常积累知识点(函数、定时任务)
企业的数字化转型到底是否可以买来?
第七章,activiti个人任务分配,动态指定和监听器指定任务委派人「建议收藏」
教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!
Go compilation principle series 6 (type checking)
mysql索引
上位机开发C#语言:模拟STC串口助手接收单片机发送数据
Create a Dapp, why choose Polkadot?
The host computer develops C# language: simulates the STC serial port assistant to receive the data sent by the microcontroller
攻防世界-PWN-new_easypwn
高质量 DeFi 应用构建指南,助力开发者玩转 DeFi Summer
【Office】Microsoft Office下载地址合集(微软官方原版离线安装下载)