๐Ÿ˜Š ๋ฐฑ์ค€ 11399 : ATM

3Juhwanยท2021๋…„ 2์›” 26์ผ
0

Algorithm

๋ชฉ๋ก ๋ณด๊ธฐ
12/23

11399: ATM

Greedy ๋‘ ๋ฒˆ์งธ ๋ฌธ์ œ~!
๊ฐ„๋‹จํ•œ ๋ฌธ์ œ์˜€๋‹ค.


๐Ÿ“Œ Try 1

N = int(input())
arr = list(map(int, input().split()))
sums = 0

for i in sorted(arr):
    sums += i * N
    N -= 1
print(sums) 

profile
Codeforces์™€ USACO ํ’€์ด๋ฅผ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค. ์ด์ „ ๊ธ€๋„ ๊ณ„์† ์—…๋ฐ์ดํŠธ ๋ฉ๋‹ˆ๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€