結果
| 問題 | No.1416 ショッピングモール |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-08 17:32:51 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 1,000 ms |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 9,216 KB |
| 実行使用メモリ | 19,176 KB |
| 最終ジャッジ日時 | 2026-04-26 07:20:27 |
| 合計ジャッジ時間 | 2,960 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
a = a.sort
now_kai = 0
min_ans = 0
while true
max = 2 ** now_kai
i = 0
ok = true
while ok
min_ans += a.pop * now_kai
#print "{a}" + " " + "#{min_ans}" + " " +"#{now_kai}" +" "+"#{i}"+ "\n"
i += 1
ok = false if a == []
break if max == i
#i += 1
end
break if ok == false
now_kai += 1
#puts "^^^^^^^^^^^^^^"
end
puts min_ans