python #baekjoon #스타트링크 썸네일형 리스트형 [baekjooon] 5014. 스타트링크 로직 설명 1. 한 단계씩 나아가면서 cnt +=1을 하고, q에 G가 들어있으면 stop ex. 1 - 3 - 2 - 1 - 4 - 5 - 4 - 7 cnt : 1 2 3 코드 import collections F, S, G, U, D = map(int, input().split()) def bfs(): if S > G and D == 0: return "use the stairs" elif S < G and U == 0: return "use the stairs" q = collections.deque([(S, 0)]) visit = [0 for _ in range(F + 1)] visit[S] = 1 while q: x, cnt = q.popleft() if x == G: return cnt if .. 더보기 이전 1 다음