728x90
SMALL
캡 쉬웠던 문제 >_<
n,m = map(int,input().split())
cards = list(map(int,input().split()))
result=list()
for i in range(n):
if cards[i]==cards[-2]:
break
for j in range(i+1,n):
for k in range(j+1,n):
if cards[i]+cards[j]+cards[k] <= m:
result.append(cards[i]+cards[j]+cards[k])
print(max(result))
728x90
LIST
'취준시절 > 백준' 카테고리의 다른 글
[백준 2309] Python - 일곱 난쟁이 (0) | 2021.08.26 |
---|---|
[백준 2231] Python - 분해합 (0) | 2021.08.26 |
[백준 1780] Python - 종이의 개수 (0) | 2021.08.25 |
[백준 1991] Python - 트리 순회 (0) | 2021.08.25 |
[백준 2630] Python - 색종이 만들기 (0) | 2021.08.25 |