[백준] 26170 사과 빨리 먹기 (Python)
# 사과 빨리 먹기import sysinput = sys.stdin.readlinearr = [list(map(int, input().split())) for _ in range(5)]r, c = map(int, input().split()) # 시작 위치# 시작 위치 방문 처리visited = [[0] * 5 for _ in range(5)]visited[r][c] = 1# 상 하 좌 우dir = [(-1, 0), (1, 0), (0, -1), (0, 1)]ans = float('inf')def dfs(y, x, cnt=0, apple=0): global ans # 종료 조건: 사과 3개 if arr[y][x] == 1 and apple == 3: ans = min(ans,..
2025. 10. 27.