본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬]11399번 ATM

by 현장 2021. 7. 22.

-코드

n = int(input())
time = sorted(list(map(int, input().split())))
r = 0
for i in range(n):
    t = 0
    for j in range(i + 1):
        t += time[j]
    r += t
print(r)