import sys, itertools
n, m = map(int,sys.stdin.readline().split())
i = [] * n
i = list(map(int,sys.stdin.readline().split()))
bignum = 0
for card in itertools.combinations(i, 3): # 3개 뽑기
result = sum(card) # 다 더하기
if bignum < result <= m:
bignum = result
print(bignum)
'개발 > Algorithm' 카테고리의 다른 글
[Python] 백준 11399번 ATM (0) | 2021.11.09 |
---|---|
[Python] 백준 1931번 회의실 배정 (0) | 2021.11.09 |
[Python] 백준 10870번 피보나치 수열 (0) | 2021.11.08 |
[Python] 백준 10872번 팩토리얼 (0) | 2021.11.08 |
[Python] 백준 더하기 사이클 1110번 (0) | 2021.11.08 |
댓글