当前位置:网站首页>nyoj58 最少步数(DFS)
nyoj58 最少步数(DFS)
2022-08-09 08:10:00 【51CTO】
最少步数
3000 ms | 内存限制: 65535
4
这有一个迷宫,有0~8行和0~8列:
1,1,1,1,1,1,1,1,1
1,0,0,1,0,0,1,0,1
1,0,0,1,1,0,0,0,1
1,0,1,0,1,1,0,1,1
1,0,0,0,0,1,0,0,1
1,1,0,1,0,1,0,0,1
1,1,0,1,0,1,0,0,1
1,1,0,1,0,0,0,0,1
1,1,1,1,1,1,1,1,1
0表示道路,1表示墙。
现在输入一个道路的坐标作为起点,再如输入一个道路的坐标作为终点,问最少走几步才能从起点到达终点?
(注:一步是指从一坐标点走到其上下左右相邻坐标点,如:从(3,1)到(4,1)。)
第一行输入一个整数n(0<n<=100),表示有n组测试数据;
随后n行,每行有四个整数a,b,c,d(0<=a,b,c,d<=8)分别表示起点的行、列,终点的行、列。
输出 输出最少走几步。 样例输入
样例输出
来源 [苗栋栋]原创
上传者 苗栋栋
一道非常简单的深搜题。只要判断好是否出界就没什么难的了。。
边栏推荐
- System Security and Application
- 测试和开发之间的恩恩怨怨
- Cookie and Session Details
- Notes on OpenHarmony Open Source Meeting (Nanjing Station)
- jdbctemplate连接sql server,代码中查出来的数据跟数据库中不一致,如何解决?
- OpenHarmony开源见面会(南京站)相关笔记
- eTS UI开发学习
- Object detection app based on appinventor and EasyDL object detection API
- C语言笔记 学习预处理 学习宏定义
- 交换机的工作原理
猜你喜欢
随机推荐
App testing
HOOPS助力 SolidWorks edrawings 引入AR/VR技术
Shell--常用小工具(sort、uniq、tr、cut)
Introduction to the Endpoint
世界顶尖3D Web端渲染引擎:HOOPS Communicator技术介绍(一)
Operations in the database (syntax)
Boot process and service control
账户和权限管理2
eTS UI开发学习
三次握手,四次挥手
Introduction to Network Layer Protocols
Cookie和Session详解
黑马2022最新redis课程笔记知识点(面试用)
【MySQL】mysql:解决[Err] 1093 - You can‘t specify target table ‘表名‘ for update in FROM clause问题
Database MySQL installation and uninstallation
OpenHarmony轻智能产品开发直播笔记
.net(三) 项目结构
pip3换源提升速度
LAN技术-6MSTP
897. 增加订单搜索树








