132391 [백준_13239] Combinations python 사실 30분간 풀었던 dp문제가 틀려서 짜증나서 급선회했다. 마찬가지로 nCk 즉 조합을 고등학교 수학시간에 배웠다면 쉽게 해결할 수 있는 문제였다. # math 라이브러리 사용 import math # t 입력 t = int(input()) for _ in range(t): # n, k 입력 n, k = map(int, input().split()) # 출력 print((math.factorial(n) // (math.factorial(k) * math.factorial(n-k))) % 1000000007) 2022. 7. 31. 이전 1 다음