Skip to content

Commit 53bd0ab

Browse files
committed
[BOJ] #10844. 쉬운계단수 / 실버1 / 40분 / 성공
1 parent 9848af2 commit 53bd0ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
n = int(input())
2+
3+
num = [[0]*10 for _ in range(n+1)]
4+
num[0] = [1,1,1,1,1,1,1,1,0] #0행에 들어가는 값들을 계단수의 경우의수로 초기화
5+
6+
for i in range(1,n+1):
7+
for j in range(10): #0일때, 9일때, 나머지인 경우를 점화식을 토대로 코드 작성
8+
if j == 0:
9+
num[i][j] = num[i-1][1]
10+
elif j == 9:
11+
num[i][j] = num[i-1][8]
12+
else:
13+
num[i][j] = num[i-1][j-1] + num[i-1][j]
14+
15+
answer = sum(num[n]) % 100000000
16+
print(answer)

0 commit comments

Comments
 (0)