一个简单的bfs,直接拿下 ">#include<queue> #include<cstring> using namespace std; const int N = 510; char g[N][N]; typedef pair<int, int>PII; int n, m; bool st[N][N]; int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 }; int x, y; bool bfs() { queue<PII>q; q.push({ 0,0 }); st[0][0] ...