题目地址:
http://acm.hdu.edu.cn/showproblem.php?pid=1241
经典深度优先遍历!
#include#define MAXN 110#define MAXM 110int n, m;char field[MAXN][MAXM];void dfs(int i, int j){ int dx, dy; int nx, ny; field[i][j] = '*'; for( dx = -1; dx <= 1; dx++ ) for( dy = -1; dy <= 1; dy++ ) { nx = i + dx; ny = j + dy; if( nx>=0 && nx =0 && ny