文章

3

粉丝

0

获赞

0

访问

70

头像
逃离迷宫 题解:
P1681 中南大学机试题
发布于2025年8月28日 13:56
阅读数 22

#include <bits/stdc++.h>
using namespace std;
struct node {
    int x, y;
    int times;
    int dirct;
};
int m, n;
char road[101][101];
int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int vis[101][101][4];

bool bfs(int sx, int sy, int k, int x2, int y2) {
    queue<node> q;
    for (int i = 0; i < 4; i++) {
        int xx = sx + dir[i][0];
        int yy = sy + dir[i][1];
        if(xx < m && xx >= 0 && yy < n && yy >= 0){
            q.push({sx, sy, 0, i});
            vis[sx][sy][i] = 0;
        }
    }
    while (!q.empty()) {
        node now = q.front();
        q.pop();
      ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发