백준 11050번 "이항 계수 1"

sanha_OvO·2021년 4월 15일
0

Algorithm

목록 보기
20/84

문제

백준 11050번 이항 계수1


풀이

C(n, k) = n!/k!(n-k)! 점화식을 사용하여 이항 계수를 풀면 된다.

파이썬의 math 라이브러리의 factorial() 함수를 사용하여 팩토리얼 계산을 하였다.


Python 코드

import sys
import math
input = sys.stdin.readline

n, k = map(int,input().split())
print(math.factorial(n)//(math.factorial(k)*math.factorial(n-k)))
profile
Web Developer / Composer

0개의 댓글