题目在https://blog.csdn.net/liuzich/article/details/97273694里面,这里只是展示另一种做法。
本来想复制提交记录,发现只有DFS的,于是又打了一遍。
emmmmm
直接看代码:
#include <bits/stdc++.h> //万能头文件
using namespace std;
int n,m,ans=0;
char a;
bool ok[108][108]; //存放是否为细胞数字(是为true,否为false)
int xx[5]={
0,0,0,1,-1},yy[5]={
0,1,-