当前位置:网站首页>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了
边栏推荐
- [Unity] [UGUI] [Display text on the screen]
- 使用工具类把对象中的null值转换为空字符串(集合也可以使用)
- FPGA: Basic Getting Started LED Lights Blinking
- 数据中台建设(十):数据安全管理
- 语音社交软件开发——充分发挥其价值
- 60行从零开始自己动手写FutureTask是什么体验?
- Meteorological data processing example - matlab string cutting matching and R language date matching (data splicing)
- 第六章:activiti流程分流判断之排它网关和并行网关
- 这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
- 【翻译】混沌网+SkyWalking:为混沌工程提供更好的可观察性
猜你喜欢

创建一个 Dapp,为什么要选择波卡?

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

RT - Thread record (a, RT, RT Thread version - Thread Studio development environment and cooperate CubeMX quick-and-dirty)

2022华数杯数学建模A题环形振荡器的优化设计思路思路代码分享

【综合类型第 35 篇】程序员的七夕浪漫时刻

FPGA: Use of the development environment Vivado

How to choose coins and determine the corresponding strategy research

Create a Dapp, why choose Polkadot?

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

百年北欧奢华家电品牌ASKO智能三温区酒柜臻献七夕,共品珍馐爱意
随机推荐
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
The century-old Nordic luxury home appliance brand ASKO smart wine cabinet in the three-temperature area presents the Chinese Valentine’s Day, and tastes the love of the delicacy
js劫持数组push方法
教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!
【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
你最隐秘的性格在哪?
牛刀小试基本语法,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang基本语法和变量的使用EP02
JS introduction to reverse the recycling business network of learning, simple encryption mobile phone number
首次去中心化抢劫?近2亿美元损失:跨链桥Nomad 被攻击事件分析
第四章:activiti流程中,变量的传递和获取流程变量 ,设置和获取多个流程变量,设置和获取局部流程变量「建议收藏」
2022华数杯数学建模A题环形振荡器的优化设计思路思路代码分享
60行从零开始自己动手写FutureTask是什么体验?
QSS 选择器
企业的数字化转型到底是否可以买来?
项目成本控制如何帮助项目成功?
Login function and logout function (St. Regis Takeaway)
Data Middle Office Construction (10): Data Security Management
如何选币与确定对应策略研究
第三章 : redis数据结构种类
使用工具类把对象中的null值转换为空字符串(集合也可以使用)