本来一道简单的搜索题,输出方式是难点
#include<stdio.h>
#include<string.h>
#include<queue>
#define inf 0x3fffffff
using namespace std;
int m,n,dp[510][510],dr[510][510];//记录到达该点的方向
char map[510][510];
int dir[4][2]={0,1,1,0,0,-1,-1,0};
int judge(int x,int y)
{
if(x>=0&&x<n&&y>=0&&y<m&&map[x][y]!='X')
return 1;
return 0;
}
struct op
{
int x,y,step,k;
};
void bfs()
{
queue<op>Q;
int i,k,x,y;
op cur,ne......
阅读全文