D题 暴力bfs遍历找最短路 唯一的变化是,碰到墙后要for循环反向走到对面的墙前即可,遇到终点要提前退出 #include<bits/stdc++.h> #define x first #define y second using namespace std; typedef pair<int,int> PII; int n,g[1005][1005],step[1005][1005]; int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1}; int bfs() { queue<pair<int,int>> q; q.pu...