[백준] 11399번 - ATM

yerimstar·2021년 6월 23일
0

Greedy Algorithm

목록 보기
3/10

최종 코드

N = int(input()) # N명
P = input()
lst = []
cnt = 0

for i in range(N):
    lst.append(int(P.split(" ")[i]))

lst.sort()

for i in range(N):
    tmp = lst[0:i+1]
    cnt += sum(tmp)

print(cnt)

입력받은 시간들을 오름차순 정렬한 뒤, 최솟값을 구한다.

profile
백엔드 개발자

0개의 댓글

Powered by GraphCDN, the GraphQL CDN