文章

13

粉丝

0

获赞

113

访问

1.7k

头像
devc++跑得了,不知道哪里错了 题解:
P1124
发布于2026年3月19日 17:50
阅读数 79

#include<bits/stdc++.h>
using namespace std;

struct node{
    int x,y;
};

const int maxn = 105;
char mpt[maxn][maxn];
int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
node G,S;
int N,M,t;
int bfs(int t){
    queue<node> qg,qs;
    qg.push(node{G.x,G.y});
    qs.push(node{S.x,S.y});
    int sum=1;
    while(t--){
        int qgsize = qg.size();
        if(qgsize==0)break;
        while(qgsize--){
            node now = qg.front();
            qg.pop();
            for(int i = 0;i<4;i++){
                int nx = now.x + dir[i][1];
         &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发