n,m = map(int,input().split())
data = list(map(int,input().split()))
res = 0
tmp = 0
for i in range(n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
tmp = data[i]+data[j]+data[k]
if tmp>=res and tmp<=m:
res = tmp
print(res)
'[BOJ] - Python' 카테고리의 다른 글
[백준] 2178 : 미로 탐색 python (0) | 2023.08.17 |
---|---|
[백준] 1260 : DFS와 BFS python (0) | 2023.08.17 |
[백준] 11286 : 절댓값 힙 python (0) | 2023.08.17 |
[백준] 13305 : 주유소 python (0) | 2023.08.13 |
[백준] 11399 : ATM python (0) | 2023.08.13 |