백준 python 기록
백준 파이썬 2407 조합
우히힝
2021. 9. 19. 15:21
백준 링크:https://www.acmicpc.net/problem/2407
2407번: 조합
n과 m이 주어진다. (5 ≤ n ≤ 100, 5 ≤ m ≤ 100, m ≤ n)
www.acmicpc.net
nCm 출력문제.
factorial을 사용하면 간단한 식으로 풀수있다.
import math
n,m=map(int,input().split())
def factorial(n,m):
return math.factorial(n) // (math.factorial(m)*math.factorial(n-m))
print(factorial(n,m))
n! / (m!*(n-m)!)