結果

問題 No.1416 ショッピングモール
ユーザー simansiman
提出日時 2021-03-07 02:38:20
言語 Ruby
(3.2.2)
結果
AC  
実行時間 110 ms / 1,000 ms
コード長 191 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 18,948 KB
最終ジャッジ日時 2023-07-30 06:34:37
合計ジャッジ時間 3,734 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,368 KB
testcase_01 AC 83 ms
15,136 KB
testcase_02 AC 82 ms
15,268 KB
testcase_03 AC 81 ms
15,016 KB
testcase_04 AC 83 ms
15,124 KB
testcase_05 AC 82 ms
15,164 KB
testcase_06 AC 83 ms
15,264 KB
testcase_07 AC 82 ms
15,308 KB
testcase_08 AC 84 ms
15,048 KB
testcase_09 AC 82 ms
15,184 KB
testcase_10 AC 80 ms
15,344 KB
testcase_11 AC 84 ms
15,156 KB
testcase_12 AC 81 ms
15,236 KB
testcase_13 AC 83 ms
15,344 KB
testcase_14 AC 84 ms
15,392 KB
testcase_15 AC 85 ms
15,284 KB
testcase_16 AC 84 ms
15,352 KB
testcase_17 AC 87 ms
15,356 KB
testcase_18 AC 87 ms
15,400 KB
testcase_19 AC 86 ms
15,444 KB
testcase_20 AC 86 ms
15,544 KB
testcase_21 AC 107 ms
18,764 KB
testcase_22 AC 110 ms
18,948 KB
testcase_23 AC 109 ms
18,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i).sort.reverse
k = 0
ans = 0

until A.empty?
  cnt = 2 ** k

  while cnt > 0 && a = A.shift
    ans += k * a
    cnt -= 1
  end

  k += 1
end

puts ans
0