这道题可以用dfs也可以用bfs,这里选用bfs。 思路:找到一个W,然后使劲的往下搜,每搜到一个点就把W变成.,直到搜不了。然后再找一个W……(禁止套娃(doge)) #include <iostream> using namespace std; const int N = 105; struct node { int x, y; }q[N * N];//结构体数组模拟队列,也可以用STLqueue char a[N][N]; int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, -1, 1, -1...