Search
Duplicate
๐Ÿฅˆ

ATM

์ฃผ์ฐจ
14
๋ฌธ์ œ๋ฒˆํ˜ธ
11399
์–ธ์–ด
Python
ํ‹ฐ์–ด
์‹ค๋ฒ„
์œ ํ˜•
๊ทธ๋ฆฌ๋””
nj_Blog
O
nj_์ƒํƒœ
์™„๋ฃŒ
์ดํ•ด๋„
ํ’€์ด
์‚ฌ๋žŒ
์ดํ•ด๋„ 2
13 more properties

๋ฌธ์ œ๋งํฌ

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 ....๋ฐ˜๋ณต๋ฌธ ๋Œ๋ฉด์„œ ๋ชจ๋‘ ๋”ํ•˜๊ธฐ