본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#71 백준 파이썬 [11399] ATM

https://www.acmicpc.net/problem/11399

 

#Solution

 

num_ppl = int(input())
waiting_time = list(map(int, input().split()))
answer = 0
waiting_time.sort()

for i in range(num_ppl):
    answer += waiting_time[i] * (num_ppl-i)

print(answer)