728x90 반응형 미로의 최단거리 통로 (bfs)1 미로의 최단거리 통로 (BFS) import sysfrom collections import dequesys.stdin = open("C:/Users/Documents/코딩테스트/BFS/input.txt", "r")# 미로의 최단거리 통로 (BFS)# 입력예제# 0 0 0 0 0 0 0# 0 1 1 1 1 1 0# 0 0 0 1 0 0 0# 1 1 0 1 0 1 1# 1 1 0 1 0 0 0# 1 0 0 0 1 0 0# 1 0 1 0 0 0 0# 출력예제# 12dx = [-1,0,1,0] # 방향 탐색dy = [0,1,0,-1] # 방향 탐색board = [list(map(int,input().split())) for _ in range(7)] # 미로 입력받기dis = [[0]*7 for _ in range(7)] # 거리계산 리스트.. 2025. 3. 10. 이전 1 다음 728x90 반응형