DFS

poj 1979 Red and Black

总计 161 字
知识点:DFS solution #include <cstdio> int W, H; char tile[25][25]; int pos_x, pos_y; int sh_x[4] = {0, 0, -1, 1}; int sh_y[4] = {1, -1, 0, 0}; int res = 0; void solve(int x, int y) { tile[y][x] = '#'; res++; for (int i=0;i<4;i++) { int new_x = x + sh_x[i]; int new_y = y + sh_y[i]; if (new_x >= 0 && new_x <W &&