模板题,注意存图的时候要用char数组,而且判断能否移动时一定不要忘了g[x][y]=='E'这个条件 #include<bits/stdc++.h> using namespace std; const int N=510; char g[N][N]; int n,m; int d[N][N]; typedef pair<int,int>pll; bool bfs() { queue<pll>q; memset(d,-1,sizeof d); int a,b,c,e; for(int i=0;i<n;i++) ...