목록스타트링크 (1)
1seul357
[BOJ] 스타트링크
F, S, G, U, D = map(int, input().split()) q = [] cnt = 0 visited = [0]*10000000 q.append([S, cnt]) while q: tmp, cnt = q.pop(0) if G == tmp: ans = cnt break for i in range(2): if i == 0 and tmp+U = 1 and visited[tmp-D] == 0: visited[tmp-D] = 1 q.append([tmp-D, cnt+1]) if len(q) == 0: print('use the stairs') exit(0) print(ans) 문제 F = 건물 최고층, G = 스타트링크 있는 곳, S = 강호의 현재 위치, U = U층을 가는 버튼, D = D층을 가..
알고리즘/백준
2022. 1. 8. 21:50