思路 题意就是有一大片地方,让你去找里面有多少片油田(八个方向),我们只需要遍历地图,当找到'@'的时候进行dfs,把搜索到的'@'都变成'*'就好了,然后用一个变量进行计数。 AC代码: #include <iostream> #include <cstring> using namespace std; const int MAXN = 105; char MAP[MAXN][MAXN]; int dir[8][2] = {1,0, 0,1, -1,0, 0,-1, 1,1, -1,1, -1,-1, 1,-1}; // 因为有8个方向 int n,m; int ...