๋ฌธ์ ๋งํฌ
https://www.acmicpc.net/problem/11399
์ฝ๋ ์ ์ถ ๊ธฐ๋ก (๋ฉ๋ชจ๋ฆฌ ๋ฐ ์๊ฐ)
๋ฉ๋ชจ๋ฆฌ : 122244 KB
์๊ฐ : 108 ms
Code
N = int(input())
arr=list(map(int, input().split()))
arr.sort() # arr.sort(reverse=True)
arr.reverse()
answer = 0
for i in range(N):
for j in range(i, N):
answer += arr[j]
print(answer)
Python
๋ณต์ฌ
๋ฉ๋ชจ
1.
๋ฐฐ์ด ์
๋ ฅ๋ฐ๊ธฐ
2.
๋ด๋ฆผ์ฐจ์ ์ ๋ ฌํ๊ธฐ
3.
0~n / 1~n / 2~n ....๋ฐ๋ณต๋ฌธ ๋๋ฉด์ ๋ชจ๋ ๋ํ๊ธฐ