文章

11

粉丝

0

获赞

94

访问

2.0k

头像
迷宫 题解:
P1563 天津大学/南开大学机试题
发布于2026年3月8日 23:03
阅读数 201

板子题 那还说啥了 多敲几遍背一背吧

 

#include <stdio.h>

#include <vector>

#include <queue>

using namespace std;

 

int H,W;

int res = 999999999;

 

struct point{

    int x,y;//坐标

    int len;//到该点的路程

    char c; //该点类型

};

 

void bfs(vector<vector<point>> &m,queue<point> &q){

    int dx[] = {1,0,-1,0};

    int dy[] = {0,1,0,-1};

    while(!q.empty()){

        struct point curr = q.front();

        q.pop();

        int cx = curr.x;

        int cy = curr.y;

 

        //到达终点

        if(curr.c=='E'){

            res = curr.len;

            return;

        }

 

     ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发