結果

問題 No.1416 ショッピングモール
ユーザー rodea
提出日時 2021-03-15 21:18:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 214 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 15,760 KB
最終ジャッジ日時 2024-11-07 10:01:50
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

cnt = 0
k = 0
ans = 0
for i in range(n):
    ans += a[i] * k
    cnt += 1
    if cnt == 2 ** k:
        k += 1
        cnt = 0

print(ans)
0