๋ฐ์ํ
๋ฐฑ์ค 11399๋ฒ [ATM]
ํ์ด)
n = int(input())
lst = sorted(list(map(int,input().split(' '))))
cnt = 0
for i in range(n,0,-1) :
cnt += i*lst[len(lst)-i]
print(cnt)
728x90
๋ฐ์ํ
'๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค > greedy' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค 1541] [greedy] ์์ด๋ฒ๋ฆฐ ๊ดํธ (0) | 2021.04.18 |
---|---|
[๋ฐฑ์ค 1931] [greedy] ํ์์ค ๋ฐฐ์ โ (0) | 2021.04.18 |
[๋ฐฑ์ค 11047] [greedy] ๋์ 0 (0) | 2021.04.17 |
[๋ฐฑ์ค 2839] [greedy] ์คํ๋ฐฐ๋ฌ (0) | 2021.04.17 |