본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬]1010번 다리 놓기

by 현장 2021. 7. 27.

-코드

from math import factorial
for _ in range(int(input())):
    n, m = map(int, input().split())
    r = factorial(m) // (factorial(m - n) * factorial(n))
    print(r)

수식을 짜는게 잘 안되어서 찾아보니 

를 찾게 되어서 해결을 했지만 뭔가 부족함을 많이 느낄 수 있었습니다.

 

 

출처:https://ko.wikipedia.org/wiki/%EC%A1%B0%ED%95%A9