[백준]S5-1010

py_code·2021년 1월 1일
0

백준-실버5

목록 보기
13/19
post-custom-banner

import operator as op
from functools import reduce

def nCr(r,n):
    if n<1 or r<0 or n<r:
        raise ValueError
    r = min(r,n-r)
    nm = reduce(op.mul, range(n,n-r,-1),1)
    dm = reduce(op.mul, range(1, r+1),1)
    return nm//dm

case = int(input())
for _ in range(case):
    R,N = map(int, input().split())
    print(nCr(R,N))
profile
개발자를 꿈꿉니다.
post-custom-banner

0개의 댓글