본문 바로가기

알고리즘 문제풀이

백준 14215 세막대기 Python

# https://jinho-study.tistory.com/768
stick = sorted(map(int,input().split()))

sum = stick[0] + stick[1] + min(stick[2],stick[0]+stick[1] -1)
print(sum)​

 

if stick[0] + stick[1] >= stick[2]:
    sum = stick[0] + stick[1] + stick[2]
else:
    stick[2] = stick[0] + stick[1] - 1
    sum = stick[0] + stick[1] + stick[2]
print(sum)

나도 윗 분처럼 짧게 만드는 연습을 해야겠다

'알고리즘 문제풀이' 카테고리의 다른 글

[백준]1546 평균 파이썬 Python  (0) 2024.01.29
백준 2884 알람시계 브3 Python  (0) 2024.01.26
백준 2754 브론즈5 Python  (0) 2024.01.26
백준 5532 방학숙제 Python  (0) 2024.01.24
신규고객 등록 Python  (0) 2024.01.18