본문 바로가기
Python3/백준 알고리즘

2022.02.28 [백준] (python 파이썬) 이항 계수 2

by ian's coding 2022. 2. 28.
728x90
반응형

 

https://www.acmicpc.net/problem/11051

 

11051번: 이항 계수 2

첫째 줄에 \(N\)과 \(K\)가 주어진다. (1 ≤ \(N\) ≤ 1,000, 0 ≤ \(K\) ≤ \(N\))

www.acmicpc.net

 


풀이

중복을 이용하여 간단히 해결함.

1
2
3
4
5
import math
 
n,k=map(int, input().split())
 
print((math.factorial(n)//(math.factorial(k)*math.factorial(n-k)))%10007)
cs

 

 

 

 

728x90
반응형

댓글