백준 10826 피보나치 수 4

김민영·2023년 1월 12일
0

알고리즘

목록 보기
66/125

과정

  • 피보나치 수를 DP로 구해본다.
  • 점화식도 알고 있으니 쉽게 구할 수 있다!
N = int(input())
lst = [0] * (N+1)
for i in range(N+1):
    if i == 0:
        lst[0] = 0
    elif i == 1:
        lst[1] = 1
    else:
        lst[i] = lst[i-1] + lst[i-2]
print(lst[N])
profile
노션에 1차 정리합니당 - https://cream-efraasia-f3c.notion.site/4fb02c0dc82e48358e67c61b7ce8ab36?v=

0개의 댓글