-Code
n, m = map(int, input().split())
order_list = [int(input()) for _ in range(n)]
position = 1
for i in range(1, m + 1):
position += int(input())
if position >= n:
print(i)
break
position += order_list[position - 1]
if position >= n:
print(i)
break
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 6491번 Perfection (0) | 2025.02.28 |
---|---|
[백준/파이썬] 5566번 Штурм (0) | 2025.02.27 |
[백준/파이썬] 33541번 2025는 무엇이 특별할까? (0) | 2025.02.25 |
[백준/파이썬] 33151번 노트북 세 대를 가지고 왔다 (0) | 2025.02.24 |
[백준/파이썬] 3554번 Enigmatic Device (0) | 2025.02.23 |