Skip to content

Commit a10c57b

Browse files
committed
[BOJ] #2193. 이친수 / 실버3 / 6분 / 성공
1 parent 8b782b8 commit a10c57b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
'''
5+
이친수:
6+
- 0과 1로 이루어진 수
7+
- 0으로 시작하지 않음
8+
- 1이 두 번 연속으로 나타나지 않음
9+
10+
N이 주어질 때, N자리 이친수의 개수 구하기
11+
'''
12+
13+
N = int(input())
14+
dp = [0] * (N + 1)
15+
dp[1] = 1
16+
17+
for i in range(2, N + 1):
18+
dp[i] = dp[i - 1] + dp[i - 2]
19+
20+
print(dp[N])

0 commit comments

Comments
 (0)