Agorithm/백준 알고리즘
백준 알고리즘 11050번 이항 계수 1(python)
kimjinho1
2020. 2. 16. 01:51
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
반응형