[Python] 블랙잭 25.03.01
2025. 3. 1. 19:37
from itertools import combinations
# 입력 처리
n, m = map(int, input().split())
cards = list(map(int, input().split())
# 조합 찾기
max_sum = 0
for combo in combinations(cards, 3):
current_sum = sum(combo)
if current_sum <= m:
max_sum = max(max_sum, current_sum)
# 결과 출력
print(max_sum)
'Programming > 탭고리즘' 카테고리의 다른 글
[Python] 별 찍기-10 25.03.02 (0) | 2025.03.02 |
---|---|
[Python] 문자열 폭발 25.02.28 (0) | 2025.03.01 |