Skip to content

Commit 3b54883

Browse files
committed
[BOJ] 합분해 (G5)
1 parent ddc9723 commit 3b54883

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

김지호/1주차/260103.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
import copy
3+
from collections import deque
4+
5+
sys.stdin = open('../input.txt', 'r')
6+
7+
N, K = map(int,input().split(" "))
8+
9+
DIVIDER = 1000000000
10+
11+
# 2차원 DP[N][K] -> 각 DP[i][j] : i개의 수로 j를 만들 수 있는 값
12+
# 최종 : DP[N][K] 구하기
13+
dp = [[1] * (N+1) for _ in range(K+1)]
14+
15+
# print2d_arr(dp)
16+
17+
# 초기화
18+
for col in range(N+1):
19+
dp[0][col] = 0
20+
21+
for row in range(2,K+1):
22+
for col in range(1,N+1):
23+
dp[row][col] = (dp[row][col-1] + dp[row-1][col]) % DIVIDER
24+
25+
26+
print(dp[K][N])
27+

0 commit comments

Comments
 (0)