https://www.acmicpc.net/problem/2789
5613번: 계산기 프로그램
입력의 각 줄에는 숫자와 +, -, *, /, =중 하나가 교대로 주어진다. 첫 번째 줄은 수이다. 연산자의 우선 순위는 생각하지 않으며, 입력 순서대로 계산을 하고, =가 주어지면, 그때까지의 결과를 출��
www.acmicpc.net
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 |