Created
March 14, 2026 01:11
-
-
Save maehrm/7647d9a17c7d5b4f29253e136f3c1c2e to your computer and use it in GitHub Desktop.
C - Digital Graffiti https://atcoder.jp/contests/abc191/tasks/abc191_c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| H, W = map(int, input().split()) | |
| S = [list(input()) for _ in range(H)] | |
| ans = 0 | |
| for i in range(H - 1): | |
| for j in range(W - 1): | |
| cnt = 0 | |
| for di, dj in ((0, 0), (0, 1), (1, 0), (1, 1)): | |
| if S[i + di][j + dj] == "#": | |
| cnt += 1 | |
| if cnt == 1 or cnt == 3: | |
| ans += 1 | |
| print(ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment