factorial 구현
def factorial(n):
num = 1
for i in range(1, n+1):
num *= i
return num
math.factorial
# 백준 1010번
import math
T = int(input())
for _ in range(T):
n, m = map(int, input().split())
bridge = math.factorial(m) // (math.factorial(n) * math.factorial(m - n))
print(bridge)
'코딩테스트 > Python 개념' 카테고리의 다른 글
| [Python] 리스트 복사 copy.deepcopy( ) (0) | 2023.03.30 |
|---|---|
| [Python] 조합, 순열 리스트 말고 값으로 출력 math.comb / math.perm (0) | 2023.03.29 |
| [Python] 리스트 값 한번에 출력하기 (0) | 2023.03.25 |
| [Python] 일급 객체 (0) | 2023.03.19 |
| [Python] yield 제너레이터 (함수 return 값 여러번에 나눠서 할때 ) (0) | 2023.03.19 |