๋ฐ์ํ
๋ด ํ์ด
n=int(input())
arr=[0 for i in range(n+1)]
arr[1]=1
for i in range(2,n+1):
arr[i]=arr[i-1]+arr[i-2]
print(arr[-1])
arr = [n๋งํผ์ ๋ฆฌ์คํธ ์๋ฆฌ๋ฅผ ๋ง๋ค์ด์]
ํ๋์ฉ ๋ฃ๋ ๋ฐฉ๋ฒ
n=int(input())
arr=[0,1]
for i in range(2,n+1):
arr.append(arr[i-1]+arr[i-2])
print(arr[n])
์ด๋ ๊ฒ ๋ฐ๋ก ๋ฃ๋ ๊ฒฝ์ฐ๋ ์๋ค.
'๐ ์๊ณ ๋ฆฌ์ฆ > ๋ฐฑ์ค Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] ์ ๋ ฌ /ํ์ด์ฌ - 1427, 10989, 1931, 1181, 11650 (0) | 2021.04.18 |
---|---|
๋ฐฑ์ค1003๋ฒ ํ์ด์ฌ ํผ๋ณด๋์นํจ์ #14-2)๋์ ๊ณํ๋ฒ1 (0) | 2020.10.21 |
๋ฐฑ์ค15652๋ฒ ํ์ด์ฌ N๊ณผM4 #13-4) ๋ฐฑํธ๋ํน (0) | 2020.10.20 |
๋ฐฑ์ค15651๋ฒ ํ์ด์ฌ N๊ณผM 3 #13-3) ๋ฐฑํธ๋ํน (0) | 2020.10.20 |
๋ฐฑ์ค15649๋ฒ ํ์ด์ฌ N๊ณผM #12-1) ๋ฐฑํธ๋ํน (0) | 2020.10.19 |
๋๊ธ