文章
94
粉丝
0
获赞
522
访问
16.4k
// 刚好充满这个条件,比如在t-1的时候充满房间了,应该输出no才对,但是我并没有写no的情况,也通过了
#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {1,0,-1,0,0,-1,0,1};
char maps[35][35];
int visited[35][35];
struct node{
int x,y,step;
};
void bfs(int nx,int ny,int t){
queue<node> q;
q.push(node{nx,ny,0});
maps[nx][ny] = '#';
while(!q.empty()){
node now = q.front();
q.pop();
int a = now.x;
int b = now.y;
for(int i = 0;i < 4; i++){
int tempX = a + dir[i][0];
int tempY = b + dir[i][1];
if(maps[tempX][tempY] == '.'&& now.step < t){
maps[tempX][tempY] = '#'...
登录后发布评论
暂无评论,来抢沙发