[백준] 13251번 조약돌 꺼내기

거북이·2023년 8월 27일
0

백준[실버3]

목록 보기
88/92
post-thumbnail

💡문제접근

  • 조합을 이용한 문제풀이

💡코드(메모리 : 33376KB, 시간 : 48ms)

import math
import sys
input = sys.stdin.readline

M = int(input())
lst = list(map(int, input().strip().split()))
K = int(input())

total = math.comb(sum(lst), K)
temp = 0
for i in lst:
    temp += math.comb(i, K)
print(temp / total)

💡소요시간 : 14m

0개의 댓글