[백준/Python] 3184번 - 양
·
Algorithm/BaekJoon
import sys input = sys.stdin.readline r, c = map(int, input().split()) yard = [list(input().rstrip()) for _ in range(r)] visited = [[False for _ in range(c)] for _ in range(r)] # . 빈필드 / # 울타리 / o 양 / v 늑대 def bfs(a, b): stack = [(a,b)] sheep, wolf = 0, 0 while stack: x, y = stack.pop() visited[x][y] = True # 양, 늑대 개수 세기 if yard[x][y] == 'o': sheep += 1 elif yard[x][y] == 'v': wolf += 1 for dx, ..