POJ3984(BFS)

POJ3984迷宫问题(BFS入门+记录路径) 问题:传送门 关于BFS算法: 宽度优先搜索算法(又称广度优先搜索)是最简便的图的搜索算法之一,这一算法也是很多重要的图的算法的原型。Dijkstra单源最短路径算法和Prim最小生成树算法都采用了和宽度优先搜索类似的思想。其别名又叫BFS,属于一种盲目搜寻法,目的是系统地展开并检查图中的所有节点,以找寻结果。换句话说,它并不考虑结果的可能位置,彻底地搜索整张图,直到找到结果为止。 题目分析: ... 阅读详情

POJ3984(BFS)


迷宫问题

Description

定义一个二维数组:

int maze[5][5] = {

	0, 1, 0, 0, 0,

	0, 1, 0, 1, 0,

	0, 0, 0, 0, 0,

	0, 1, 1, 1, 0,

	0, 0, 0, 1, 0,

};

它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。

Input

一个5 × 5的二维数组,表示一个迷宫。数据保证有唯一解。

Output

左上角到右下角的最短路径,格式如样例所示。

Sample Input

0 1 0 0 0
0 1 0 1 0
0 0 0 0 0
0 1 1 1 0
0 0 0 1 0

Sample Output

(0, 0)
(1, 0)
(2, 0)
(2, 1)
(2, 2)
(2, 3)
(2, 4)
(3, 4)
(4, 4)
题意

略。

思路

使用BFS从(0,0)开始搜索,用队列记录搜索的过程,直到右下角(4,4),输出路径即可。

代码
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Maze {

  int[][] map = new int[5][5];//迷宫地图
  int[][] direction = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};//四个方位
  int[][] visit = new int[5][5];//记录是否已经访问过
  List<Node> queue = new ArrayList<Node>();//队列

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Maze maze = new Maze();


    for (int i = 0; i < 5; i++) {
      for (int j = 0; j < 5; j++) {
        maze.map[i][j] = sc.nextInt();
        maze.visit[i][j] = 0;
      }
    }

    maze.bfs(0, 0, 4, 4);
    maze.print(maze.queue.size() - 1);

  }

  public void bfs(int startX, int startY, int endX, int endY) {

    visit[startX][startY] = 1;

    Node node = new Node();
    node.setX(startX);
    node.setY(startY);
    node.setPre(-1);
    queue.add(node);
    int rear = 1;//队尾
    int front = 0;//队头

    while (front < rear) {//对列不为空
      for (int i = 0; i < 4; i++) {//遍历上下左右4个方位的点
        int nextX = queue.get(front).getX() + direction[i][0];
        int nextY = queue.get(front).getY() + direction[i][1];
        if (nextX < 0 || nextX >= 5 || nextY < 0 || nextY >= 5 || visit[nextX][nextY] == 1 || map[nextX][nextY] == 1) {
          //是否在迷宫内,是否已访问过,是否是墙壁。
          continue;
        }
        Node tmp = new Node();
        tmp.setX(nextX);
        tmp.setY(nextY);
        tmp.setPre(front);
        queue.add(tmp);
        rear++;
        visit[nextX][nextY] = 1;
        if (nextX == endX && nextY == endY) {
          return;
        }
      }
      front++;//出队
    }

  }

  public void print(int now) {
    if (queue.get(now).getPre() == -1) {
      System.out.println("(" + queue.get(now).getX() + ", " + queue.get(now).getY() + ")");
    } else {
      print(queue.get(now).getPre());
      System.out.println("(" + queue.get(now).getX() + ", " + queue.get(now).getY() + ")");
    }
  }

  static class Node {
    private int x;
    private int y;
    private int pre;

    public int getX() {
      return x;
    }

    public int getY() {
      return y;
    }

    public int getPre() {
      return pre;
    }

    public void setX(int x) {
      this.x = x;
    }

    public void setY(int y) {
      this.y = y;
    }

    public void setPre(int pre) {
      this.pre = pre;
    }
  }
}
【算法】【题解】- POJ - 3984 迷宫问题(BFS入门例题) BFS入门例题 迷宫问题 题目描述: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。 Input... 阅读详情

相关推荐

leetcode打不开-codeBook:为了好玩,永远

leetcode打不开密码本 为了好玩,永远 poj 的代码。 所有 C++ 代码。 bfs.cpp:我的 poj 3984 解决方案。最短路径的 BFS,并递归地追溯路径。 解决这个问题我想起了很多:如何定义mutli-dim vector,如何定义队列,如何定义struct数组,如何定义方向,如何编写BFS,如何跟踪路径。 请注意,BFS 本身不是递归实现的(相反,DFS 通常以递归方式实现)。 unionSet.cpp:我的 poj 2524 解决方案。Union Set 的简单应用。 我记得我们准备 ACM/ICPC 比赛的那段时间。 我重新学习了如何实现联合集:makeSet、findSet、unionSet。 两个关键点:通过查找操作为即将到来的对进行并集时沿跟踪路径更新根节点(压缩路径); 将两个子集按等级合并(按合并)。 binSearch.cpp:我为二进制搜索编写了示例代码。 找到目标时记得完成while循环。 dfs.cpp:一个 poj 问题 (3050)。 DFS 非常常用。 记住 dfs 之后的回溯。 这里我们不需要像 BFS 那样使用 used 来记住访问

POJ 3984 迷宫问题 (DFS(深度优先搜索))

迷宫问题 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6322   Accepted: 3673 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,

公众号:ByteCode 2177

英伟达NVIDIA数字IC后端笔试真题(ASIC Physical Design Engineer)

英伟达NVIDIA数字IC后端笔试真题(ASIC Physical Design方向)

weixin_37584728的博客 3913

POJ-3984-迷宫问题

这题是bfs的基础性题目,但是基础才显得很重要。 题目中的要求是输出每一个我们走过的点,所以我们每次记录下它的上一个节点是谁就行了。 但是我们因此就不能再使用队列了,我们开辟一个一维数组就行了,因为迷宫的大小是5*5的,所以我们直接开一个一维数组,然后模拟一下队列的进出就行了。 这个题比较坑的一点是它的输出圆括号里面,逗号后面有个空格,一定要输出,不然它会说,你的答案几乎正确,但是格式不对。...

XYQ BLOG 1668

RT-Thread学习笔记(5):SPI驱动框架分析

1、两个设备模型 在spi驱框架中,一般会自己初始化一个总线设备(rt_spi_bus),当我们通过挂载后,会相应注册一个从设备(rt_spi_device)。 1、总线设备模型 struct rt_spi_bus { struct rt_device parent; rt_uint8_t mode; const struct rt_spi_ops *ops; struct rt_mutex lock; struct rt_spi_device *owner; };

BLBQ962464的博客 1万+

【Docker】如何让docker容器正常使用nvidia显卡

描述了如何在docker容器中使用英伟达显卡的过程和问题解决方法。

NameLoadingFailed的博客 8372

POJ3984(BFS+路径还原)

package adv; import java.util.ArrayDeque; import java.util.Scanner; /** * Poj3984迷宫问题 * BFS+路径还原 */ public class POJ3984 { static int T,n,m,ans; static int startx,starty,endx,endy; static int[][] map; static boolean[][] flag; static int[][] dir .

抖擞精神 354

从ADS到SystemVue:当简单链路预算不够用时,我的射频系统级仿真方案升级实录

本文详细介绍了从ADS到SystemVue的射频系统级仿真升级路径,重点分析了基础链路预算在多端口元件和复杂场景下的局限性,并提供了SystemVue在非线性系统验证和跨域协同分析中的优势。通过实际案例展示了如何平滑迁移工具链,提升仿真精度和效率,适用于5G、毫米波雷达等现代射频系统设计。

weixin_34233974的博客 343

POJ3984(迷宫问题)

迷宫问题 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。 Input 一个5 × 5的二维数组,表示一个迷宫。数据保证有唯一解。 Output 左上角到右下角的最短路径,格式如样例所示

weixin_43808717的博客 607

如何优化Silvaco二极管仿真网格?这些参数设置技巧让你的结果更精确

本文详细介绍了如何优化Silvaco二极管仿真网格,通过精细调整网格参数提升仿真精度。重点解析了网格密度与计算精度的权衡、关键区域识别与网格强化策略,以及掺杂分布与网格适配技术,帮助工程师在半导体器件仿真中获得更准确的结果。

t8u9v0w1x的博客 660

Sigrity System SI SerialLink模式进行SFP+协议仿真分析-PCB操作指导

Random(Rj):随机抖动,该抖动用高斯概率分布来描述,通常是由热噪声和其它随机噪声引起的,默认为1%UI RMS(平均值),即和标准值的偏差为1%UI。Random(Rj):随机抖动,该抖动用高斯概率分布来描述,通常是由热噪声和其它随机噪声引起的,默认为1%UI RMS(平均值),即和标准值的偏差为1%UI。Random(Rj):随机噪声,是由信号电压的随机波动引起的,默认为1mv RMS(平均值),即和标准值的偏差为1mv。

weixin_54787054的博客 507

POJ3984(记录路径的BFS)

POJ3984 思路 用一个pre数组存储这个点的上一个点 ##AC代码 #include<iostream> #include<cstdio> #include<queue> #include<cstring> #define inf 0x3f3f3f3f //#define int long long using namespace std; typedef pair<int, int> PII; const int N = 10 + 1e5,

weixin_58110654的博客 172

从传感器到执行-智能家居 Agent 的感知-决策-执行闭环

本文提出了一种面向智能家居的感知型Agent架构,通过"感知-决策-执行"的闭环系统实现智能化控制。感知模块整合多源传感器数据,决策模块基于规则或机器学习模型生成控制策略,执行模块完成设备操作。系统能够实时监测环境参数和用户状态,自动调节温度、照明等设备,提升家居舒适度。该架构可扩展为多模态感知与强化学习相结合的智能系统,为智慧家居发展提供技术基础。

一键难忘的博客 1122

bfs解决poj3984迷宫问题

poj3984迷宫问题 题目链接 题目叙述 给定一大小为5*5的数组,数组元素由0,1组成,0表示可以通过,1表示为墙壁,不可通过,而且只能向上,向下,向左,向右行走,现要求从(0,0)位置到(4,4)位置的最短路径。 解题思路 首先,求最短路径问题,很明显可以用到宽度优先搜索bfs,从(0,0)点开始,走四面可以走的路,然后再从这些路,找继续可以往下走的路,直到最先找到了一条路径可以走到(4,4)点,这里需要用到队列queue去储存从所在点的位置走一步可以到达的点,(在走的时候,需要注意坐标x,y都要在

weixin_43966538的博客 523

软件集成:Simulink与STM32联合开发

本文首先通过一个简单的Simulink模型生成代码,然后将代码copy到一个STM32工程中去编译软件。最后将软件下载到STM32F407中,通过串口输出Simulink计算的结果。 阅读本文需要有一定的STM32开发调试经验和Simulink代码生成经验。关于Simulink代码生成可以参考博主的专栏《Simulink代码生成》。 文章目录1 问题引入2 集成方案3 建模与编程过程3.1 Simulink模型搭建3.2 代码生成配置3.3 STM32工程搭建3.4 STM32的main.c文件修改3.4.

u013288925的博客 2万+

visio安装包

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

POJ3984 迷宫问题【BFS】

题目大意: 用一个5*5的二维数组表示迷宫,输出左上角到右下角的最短路径。 思路: 用BFS求最短路径。用pre[]来记录每个状态之前的状态,然后递归输出路径。

程序员充电站(itcharge) 3435

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

bfs+路径保存 poj3984

bfs+路径保存 #include<iostream> #include <queue> #include <cstring> using namespace std; typedef struct nodee { int x; int y; int step; }node; int sz[2][4] = {0,1,0,-1,1,0,-1...

时夜2333的农场 1353

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

poj3984-迷宫问题(BFS)

# include # include int map[5][5]; int dir[4][2]={1,0,-1,0,0,1,0,-1}; struct node { int x,y; };struct node queue[33],record[5][5]; void bfs() { int head,tail,i; struct node cur,nex

Griffin_0的专栏 433

POJ - 3984 迷宫问题 【BFS】

题目链接 http://poj.org/problem?id=3984 思路 因为要找最短路 用BFS 而且 每一次 往下一层搜 要记录当前状态 之前走的步的坐标 最后 找到最短路后 输出坐标就可以了 AC代码 #include <cstdio> #include <cstring> #include <c...

dianxi0949的博客 91

迷宫问题 (POJ - 3984 ,BFS + 路径输出)

一.题目链接: POJ-3984 二.题目大意: 给出一个迷宫,输出路径. 三.分析: 初学 bfs 的小伙伴在入坑 bfs 后,终于学会了判断迷宫问题是否能够到达终点。 那么, 现在又迎来了一个新的问题 —— 若迷宫的解唯一, 那么怎样输出迷宫路径呢 ? 比如 poj 3984 迷宫问题 在 AC 之后, 写这篇博客不仅是为了供大家学习,斧正, 更是为了自身的总结, 吸取教训。 ...

The___Flash的博客 1923

POJ3984 迷宫问题 BFS

<br />Problem Address:http://poj.org/problem?id=3984<br /> <br />求迷宫的最短路径。<br /> <br />本来是打算试一下怎么求迷宫的,结果最后做出来了。<br /> <br />BFS搜索,同时记录到达每一步的最小步数。<br /> <br />输出路径时则向前递归。<br /> <br />一次RTE后改大数组,然后AC。然后就不改了,直接保存……<br /> <br />如此凌乱的代码啊……不堪入目啊……<br /> <br />也正

Human_CK的专栏 983

POJ3984迷宫问题(BFS+队列+栈)

POJ-3984-迷宫问题 http://poj.org/problem?id=3984 大概思路:进行普通的BFS,用队列来操作。在保存路径的时候,可以用栈来输出路径,利用先进后出的特性。

Seawindson的博客 1680

POJ 3984 迷宫问题(bfs)

嗯... 题目链接:http://poj.org/problem?id=3984 这道题属于bfs + 记录路径,在bfs的模板上需要有些更改: bfs求最短路径有一个优点就是求出来的第一条路径就是最短路径,这与bfs的性质有关... 首先要记录路径的长度,然后要记录每次决策的方向...最后输出时从起点开始将记录下来的决策走一遍然后接着输出即可... AC代...

weixin_30426065的博客 56

POJ 3984 迷宫问题【迷宫最短路径 bfs】

POJ 3984 【迷宫最短路径 bfs】 题目链接 http://poj.org/problem?id=3984 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int MAXL = 10; // 矩阵最大宽度 char maze[MAXL][MAXL]; // 迷宫 bool v

... 450
上一篇: POJ3414(BFS)
下一篇: POJ1111(DFS)
shui2104
博客等级 码龄10年 22粉丝 104原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值