https://www.acmicpc.net/problem/2789
from itertools import combinations
number, limit = input().split()
number=int(number)
limit=int(limit)
numbers=[]
numbers=list((map(int,input().split())))
maxx=numbers[0]
tmp = list(combinations(numbers,3))
cnt=0
for c in range(len(tmp)):
if sum(tmp[c])<=limit:
maxx=max(sum(tmp[c]),maxx)
cnt+=1
print(maxx)
'자기개발👨💻 > 코딩 알고리즘' 카테고리의 다른 글
[python] 백준 1259 팰린드롬수 (0) | 2020.08.29 |
---|---|
[python] 백준 2386 도비의 영어 공부 (0) | 2020.08.29 |
[python] 백준 2588 곱셈 (0) | 2020.08.29 |
[python] 백준 2607 로마 숫자 (실패70 성공 20 ?? 10) (0) | 2020.08.27 |
[c++] 백준 1652 누울 자리를 찾아라 (0) | 2020.08.15 |
[python] 백준 6603 로또 (0) | 2020.08.12 |