반응형
nCr = n-1Cr-1 + n-1Cr
n, r = map(int, input().split())
dp = [[1]*(i+1) for i in range(n+1)]
for i in range(2, n+1):
for j in range(1, i):
dp[i][j] = dp[i-1][j-1]+dp[i-1][j]
print(dp[n][r]) # nCr
nCr = n-1Cr-1 + n-1Cr
n, r = map(int, input().split())
dp = [[1]*(i+1) for i in range(n+1)]
for i in range(2, n+1):
for j in range(1, i):
dp[i][j] = dp[i-1][j-1]+dp[i-1][j]
print(dp[n][r]) # nCr
댓글