import sys
n = int(sys.stdin.readline())
time = list(map(int, sys.stdin.readline().split())) # 리스트로 받고
time.sort(key=lambda x: -x) #큰 순서대로 정렬
fulltime = 0
for t in range(n):
fulltime += time[t] * (t+1) #실제로는 시간이 적은 순으로 진행된다.
#적은 시간은 계속해서 대기시간으로 더해지므로 여러번 곱한다.
print(fulltime)
'개발 > Algorithm' 카테고리의 다른 글
[Python] 백준 1181번 단어 정렬 (0) | 2021.11.10 |
---|---|
[Python] 백준 1541번 잃어버린 괄호 (0) | 2021.11.09 |
[Python] 백준 1931번 회의실 배정 (0) | 2021.11.09 |
[Python] 백준 2798번 블랙잭 (0) | 2021.11.08 |
[Python] 백준 10870번 피보나치 수열 (0) | 2021.11.08 |
댓글