http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/N
这两天总是因为一些小错误耽误时间,我希望自己可以细心点。珍惜时间,珍爱生命!
#include<iostream>
#include<algorithm>
#include<string.h>
#include<ctype.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<limits.h>
#include<queue>
#include<stack>
using namespace std;
#define INF 0xfffffff
#define max(a, b) a>b?a:b
#define min(a, b) a<b?a:b
#define N 210
int dir[4][2]= {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int m, n, visit[N][N];
char maps[N][N];
typedef struct maze
{
int x, y, s;
} MAZE;
MAZE a, b;
struct node
{
int t1, t2, t;
} p[N][N];
void BFS();
void bfs();
void print();
int main()
{
while(scanf("%d%d", &m, &n)!=EOF)
{
for(int i=0; i<m; i++)
{
getchar();
for(int j=0; j<n; j++)
{
scanf("%c", &maps[i][j]);
if(maps[i][j]=='Y')
{
a.x=i;
a.y=j;
a.s=0;
maps[i][j]='.';
}
if(maps[i][j]=='M')
{
b.x=i;
b.y=j;
b.s=0;
maps[i][j]='.';
}
}
}
memset(p, 0, sizeof(p));
memset(visit, 0, sizeof(visit));
BFS();
memset(visit, 0, sizeof(visit));
bfs();