728x90
반응형
단순 수학 문제이다. nCk는 n! / (k!*(n-k)!)이다. math 라이브러리에 있는 factorial 함수를 사용해서 쉽게 풀었다.
import math
n1, n2 = map(int, input().split())
ans = math.factorial(n1) // math.factorial(n1-n2) // math.factorial(n2)
print(ans)
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 11399번 ATM(python) (0) | 2020.02.16 |
---|---|
백준 알고리즘 11051번 이항 계수 2(python) (0) | 2020.02.16 |
백준 알고리즘 11047번 동전 0(python) (0) | 2020.02.16 |
백준 알고리즘 11022번 A+B - 8(python) (0) | 2020.02.15 |
백준 알고리즘 11021번 A+B - 7(python) (0) | 2020.02.15 |