题目链接~~>
这题其实很简单,在走楼梯时只要判断是否能走就可以,如果不能走,可以选择等下一分钟再走,还有一点就是楼梯不能标记,可以从不同方向过。
代码:
#include<stdio.h>
#include<queue>
using namespace std ;
int dx[4]={-1,1,0,0},dy[4]={0,0,1,-1} ;
char s[25][25] ;
int m,n ;
struct zhang
{
int x,y,bu ;
} ;
int bfs(int x,int y)
{
queue<zhang>q ;
zhang current,next ;
int sx,sy ;
current.x=x ;
current.y=y ;
s[x][......
阅读全文