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
반응형

+ Recent posts