POJ 3051 Satellite Photographs
ソースコード
int w, h; char c[1024][100]; int dfs(int x, int y) { if (!in_rect(x, y, w, h) || c[y][x] != '*') return 0; c[y][x] = '.'; int s = 1; rep(i, 4) s += dfs(x + dx[i], y + dy[i]); return s; } int main() { cin >> w >> h; rep(i, h) cin >> c[i]; int res = 0; rep(y, h) rep(x, w) chmax(res, dfs(x, y)); cout << res << endl; }