반응형
n,m = map(int,input().split())
item = input().split()
result = []
for i in range(0,n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
temp = int(item[i])+int(item[j])+int(item[k])
if temp <= m:
result.append(temp)
print(max(result))
반응형
'Algorithm > Baekjoon' 카테고리의 다른 글
| 7568 (0) | 2021.05.10 |
|---|---|
| 2231 (0) | 2021.05.09 |
| 11729 (0) | 2021.05.09 |
| 2581 (0) | 2021.05.08 |
| 1978 (0) | 2021.05.08 |