POJ2251Dungeon Master(bfs)

红米12C刷机避坑指南:NV数据损坏的修复与系统版本选择 本文提供了红米12C刷机过程中避免NV数据损坏的详细指南,涵盖系统版本选择、SP刷机工具使用和fastboot命令修复。重点分析了NV数据损坏的原因与表现,并给出通过工程固件和深度修复技巧解决基带未知、IMEI丢失等问题的实操方案,帮助用户安全完成刷机。 阅读详情

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid rock on all sides.

Is an escape possible? If yes, how long will it take?
Input
The input consists of a number of dungeons. Each dungeon description starts with a line containing three integers L, R and C (all limited to 30 in size).
L is the number of levels making up the dungeon.
R and C are the number of rows and columns making up the plan of each level.
Then there will follow L blocks of R lines each containing C characters. Each character describes one cell of the dungeon. A cell full of rock is indicated by a '#' and empty cells are represented by a '.'. Your starting position is indicated by 'S' and the exit by the letter 'E'. There's a single blank line after each level. Input is terminated by three zeroes for L, R and C.
Output
Each maze generates one line of output. If it is possible to reach the exit, print a line of the form
Escaped in x minute(s).

where x is replaced by the shortest time it takes to escape.
If it is not possible to escape, print the line
Trapped! 
bfs找路径,就是多了一个上楼下楼的操作,好水的题啊都不好意思写题解

AC代码

#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<algorithm>
#include<cstring>
using namespace std;
int L,R,C;
char m[35][35][35];
int vis[35][35][35];
int to[4][2]={0,1,1,0,0,-1,-1,0};
struct node
{
    int x,y,step,lev;
}sta,End;
int ans;
void bfs(node sta)
{
    queue<node>q;
    while(!q.empty())q.pop();
    sta.step=0;
    q.push(sta);
    vis[sta.lev][sta.y][sta.x]=1;
    node temp,temp1,temp2,temp3;
    while(!q.empty()&&ans==-1)
    {
        temp=q.front();q.pop();
        if(temp.lev==End.lev&&temp.x==End.x&&temp.y==End.y){ans=temp.step;break;}
        for(int i=0;i<4;i++)
        {
            temp1.x=temp.x+to[i][0];temp1.y=temp.y+to[i][1];temp1.lev=temp.lev;temp1.step=temp.step+1;
            if(!vis[temp1.lev][temp1.y][temp1.x])
            {
                vis[temp1.lev][temp1.y][temp1.x]=1;
                if(m[temp1.lev][temp1.y][temp1.x]=='.'||m[temp1.lev][temp1.y][temp1.x]=='E')
                    q.push(temp1);
            }
            temp2.x=temp.x;temp2.y=temp.y;temp2.lev=temp.lev+1;temp2.step=temp.step+1;
            if(!vis[temp2.lev][temp2.y][temp2.x])
            {
                vis[temp2.lev][temp2.y][temp2.x]=1;
                if(m[temp2.lev][temp2.y][temp2.x]=='.'||m[temp2.lev][temp2.y][temp2.x]=='E')
                    q.push(temp2);
            }
            temp3.x=temp.x;temp3.y=temp.y;temp3.lev=temp.lev-1;temp3.step=temp.step+1;
            if(!vis[temp3.lev][temp3.y][temp3.x])
            {
                vis[temp3.lev][temp3.y][temp3.x]=1;
                if(m[temp3.lev][temp3.y][temp3.x]=='.'||m[temp3.lev][temp3.y][temp3.x]=='E')
                    q.push(temp3);
            }
        }
    }
}
void in()
{
    for(int i=1;i<=L;i++)
        {
            for(int j=1;j<=R;j++)
            {
                for(int k=1;k<=C;k++){
                    cin>>m[i][j][k];
                    if(m[i][j][k]=='S')
                    {
                        sta.x=k,sta.y=j;
                        sta.lev=i;
                    }
                    else if(m[i][j][k]=='E')
                    {
                        End.x=k,End.y=j;
                        End.lev=i;
                    }
                }
            }
        }
}
int main()
{
    while(~scanf("%d%d%d",&L,&R,&C))
    {
        if(L+R+C==0)break;
        memset(vis,0,sizeof vis);
        ans=-1;
        in();
        bfs(sta);
        if(ans==-1)
            printf("Trapped!\n");
        else
            printf("Escaped in %d minute(s).\n",ans);
    }
    return 0;
}






论文精读——A Comprehensive Survey of Continual Learning: Theory, Method and Application 为了应对现实世界的动态性,智能系统需要在其整个生命周期中逐步获取、更新、积累并利用知识。这种能力被称为Continue Learning(持续学习)。从广义上讲,持续学习明显受到catastrophic forgetting(灾难性遗忘)的限制,即学习新任务通常会导致旧任务的性能急剧下降。Continue Learning的核心目的有二,其一为(稳定性与可塑性间的权衡),其二为(足够的任务内/任务间泛化能力)。 阅读详情

相关推荐

银河麒麟Arm64 v10 sp1系统QT5.12.8离线环境配置全攻略

本文详细介绍了在银河麒麟Arm64 v10 sp1系统上配置QT5.12.8离线开发环境的完整流程。从安装包获取、依赖检查到环境变量配置,逐步指导开发者解决飞腾处理器架构下的常见问题,包括OpenGL库冲突、中文乱码处理等,特别适合军工、政务等需要离线部署的场景。

weixin_26899659的博客 503

[DnA] 三维迷宫问题

题面: http://poj.org/problem?id=2251 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, eas

ykun089的博客 324

【ROS】usb_cam相机标定

1. 唠叨两句 当我们要用相机做测量用途时,就需要做相机标定了,不然得到的计算结果会有很大误差,标定的内容包括三部分:内参,外参还有畸变参数。所以标定的过程就是要求得上面这些参数。 以前弄这个事估计挺麻烦,需要做实验和计算才能得到,现在通过ros的开源包几分钟就能完成相机标定,感激! 具体的内外参和畸变系数的说明,可以看看Reference里面的第一个链接,写得很详细。 2. 准备工作 要准备三样东西: usb_cam的ROS启动包 相机标定的ROS包 还有一个用于标定的棋盘格 1)usb_cam启动包

Will_Ye的博客 8195

3D迷宫逃生

You are trapped in a 3D dungeon and need to find the quickest way out!The dungeon is composed of unit cubes which may or may not be filled with rock.It takes one minute to move one unit north, south, ...

小糊涂的博客 503

团子杂记:SAP收入确认工具RAR(Revenue Recognition&Reporting)在新收入准则下的应用

SAP收入确认工具RAR知识分享

Lucas1211的博客 4280

Android14 RK3576开发板有线网卡静态IP配置全攻略(附数据库修改详解)

本文详细介绍了在Android 14 RK3576开发板上实现有线网卡出厂默认静态IP配置的完整方案。通过深入修改系统源码和SettingsProvider数据库,扩展全局设置字段并注入默认值,确保设备首次启动即自动应用预设的IP地址、子网掩码、网关和DNS,适用于工业控制、数字标牌等批量部署场景,有效提升生产效率。

weixin_29253711的博客 604

L - 12(BFS)

Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one

sdau20163940的博客 386

Cadence Allegro 17.4学习记录开始02-原理图Capture CIS 17.4

Allegro的第一方网表与第三方网表有以下几个区别点;Ø 与Allegro实现交互式操作的是第一方网表,第三方网表时不可以实现交互式操作;Ø 第三方网表不能将器件的Value属性导入到PCB中,输出时以封装属性来代替Value属性,第一方网表是可以的;Ø 网表导入到PCB中时,第三方的网表需要指定事先指定好PCB封装库文件,并产生Device文件,才可以将网表导入到PCB中,第一方网表则可以直接导入。

qq_31444421的博客 1万+

POJ 2251 Dungeon Master(地牢大师)

POJ2251 Dungeon Master(地牢大师) TimeLimit:1000MSMemoryLimit:65536K Description- 题目描述   You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is c...

341

均值回归 高频交易_基于布林带的均值回归交易策略

BOLL指标是美国股市分析家约翰·布林根据统计学中的标准差原理设计出来的一种非常简单实用的技术分析指标。一般而言,股价的运动总是围绕某一价值中枢(如均线、成本线等)在一定的范围内变动,布林线指标正是在上述条件的基础上,引进了“股价通道”的概念,其认为股价通道的宽窄随着股价波动幅度的大小而变化,而且股价通道又具有变异性,它会随着股价的变化而自动调整。由于之前大部分交易策略都是选股或者趋势追踪的择时,...

weixin_42528534的博客 1457

【100%通过率】华为OD机试真题 Python 实现【打印机队列】【2022.11 Q4 新题】

有5台打印机打印文件,每台打印机有自己的待打印队列。因为打印的文件内容有轻重缓急之分,所以队列中的文件有1~10不同的代先级,其中数字越大优先级越高。打印机会从自己的待打印队列中选择优先级最高的文件来打印。如果存在两个优先级一样的文件,则选择最早进入队列的那个文件。现在请你来模拟这5台打印机的打印过程。

MISAYAONE的博客 1万+

3维迷宫

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south...

正月看雪花的博客 384

RK3588网卡出现丢包或者带宽不足的问题验证排查

注意除了有最大的TCP数据接收缓冲,还有/proc/sys/net/core/wmem_max — 最大的TCP数据发送缓冲可以调整,这里暂时没用到,针对具体需要可适当调整。比如把ethx接口中断从默认的cpu0迁移到其它cpu,例如将eth0中断234移到cpu7 (10是16进制, cpu0 =3588的cpu有8个核,4个A55(小核)+4个A76(大核),可以找到对应中断 将中断从默认cpu0核切到cpu7。tcp_rmem:单位是字节,接收缓存区大小,缓存从对端接收的数据,后续会被应用程序读取。

Android/Linux驱动开发传帮带学习,让驱动入门门槛更低! 2024

三维bfs Dungeon Master POJ - 2251

三维bfs Dungeon Master POJ - 2251 题目链接 一直莫名其妙的错误 。。。 两种方法 一种用到队列 另一种其实也和队列差不多 不用队列 #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;iostream&gt; #include&lt;queue&gt; using namespace std; ...

qq_43559193的博客 556

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

poj-2251 Dungeon Master【bfs】

很基础的一道bfs /*这题是一个三维的迷宫题目,其中用'.'表示空地,'#'表示障碍物,'S'表示起点,'E'表示终点, 求从起点到终点的最小移动次数,解法和二维的类似, 只是在行动时除了东南西北移动外还多了上下。 对于题目给出数据的含义就是输入l,r,c,分别代表迷宫有l层,每层长宽分别是c,r。 对于数据以可以这样移动 (1,1,1)->(1,1,2)->(1,1,3)->(1,1,4)-

a915800048的专栏 1400

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

POJ 2251(WA)Dungeon Master(三维BFS)

POJ 2251 Dungeon Master 三维简单BFS You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one

No Rain,No L'Arc~en~Ciel 433

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

POJ-2251 Dungeon Master (BFS+优先队列)

这题是今年4月我们校队选拔时的最后一题,当时用的是一样的方法怎么做却都是WA,最后也没做出来;时隔3个月再做一遍才AC,也算填上了一个坑。。。orz Description 你被困在一个三维的空间中,现在要寻找最短路径逃生! 空间由立方体单位构成 你每次向上下前后左右移动一个单位需要一分钟 你不能对角线移动并且四周封闭 是否存在逃出生天的可能性?如果存在,则需要多少时间? Input 输入第一行...

Irimsky 251

Poj 2251 Dungeon Master [简单搜索,BFS]

POJ 2251 Dungeon Master 题目链接: 题目描述: You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one...

weixin_31808637的博客 168

Dungeon Master POJ - 2251 (三维空间BFS搜索)

题目链接:https://vjudge.net/problem/POJ-2251 题目描述:给定一个长宽高分别为R、C、L的立体空间,S代表起点,E表示终点,"."表示可通过,"#"表示不可通过,每次可从当前坐标向前后左右上下六个方向移动,但是不可以对角移动。求起点到终点最短路,若不可达,输出“Trapped!”。 思路;BFS常适用于搜索最短路径的解,BFS过程中搜索到的解一定是离根最近的,

smwqd_yehua_cx的博客 381

POJ2251 Dungeon Master —— BFS

题目链接:http://poj.org/problem?id=2251 Dungeon Master Time Limit:1000MS Memory Limit:65536K Total Submissions:37296 Accepted:14266 ...

alince20008的博客 206

POJ - 2251 Dungeon Master (三维地图内的 bfs 找最短距离)

POJ - 2251 Dungeon Master (三维地图内的 bfs 找最短距离) You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It...

weixin_43179892的博客 271

POJ2251—— BFS——Dungeon Master

http://poj.org/problem?id=2251 /* 简单bfs,向六个方向拓展 */ /************************************************ * Author :Powatr * Created Time :2015-8-9 9:23:15 * File Name :B.cpp ...

dgjm4087的博客 154

POJ 2251 Dungeon Master(BFS)

POJ 2251 Dungeon Master Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes on...

weixin_30567471的博客 108

POJ - 2251 - Dungeon Master(三维bfs)

Alibaba_lhl的博客 242

POJ2251 Dungeon Master BFS

Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one

colorfulshark 1081

Dungeon Master POJ - 2251 BFS

一、内容 题意:给定一个3D的图,你能走6个方向,问从起点到终点最少的步数。 二、思路 bfs搜素一下。 三、代码 #include <cstdio> #include <cstring> #include <queue> #include <iostream> using namespace std; int l, r, c, sl, sx,...

Tizzi的博客 873
上一篇: POJ2236 Wireless Network(并查集)
下一篇: poj3186(记忆化搜索)
T__TSZ
博客等级 码龄10年 2粉丝 70原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值