백준135491 [알고리즘] 백준 13549 숨바꼭질 3 백준 13549 숨바꼭질 3 이 문제는 단순 BFS문제라고 생각했다.import sysimport collectionsfrom collections import dequen,m = map(int,sys.stdin.readline().split())MAX = 100000res = [0]*(MAX+1)res[n] = 1dq = deque()dq.append(n)while dq: ex = dq.popleft() if ex == m: print(res[ex]-1) break for num in (ex+1,ex-1,ex*2): if 0 📌 처음 이러한 풀이로 제출했지만 틀렸다. 그래서 30분 정도를 애 먹었다.키 포인트는 ex의 두 배와 (ex+1,ex-1)의 가.. 2024. 10. 14. 이전 1 다음