結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-27 18:19:28 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 301 bytes |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-11-24 04:55:48 |
| 合計ジャッジ時間 | 10,415 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 TLE * 2 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n, m = gets.split.map(&:to_i)
box = gets.split.map(&:to_i)
count = 0
empty_box = 0
while m > count
if box.min > 0
box[box.index(box.min)] -= 1
count += 1
if box.min == 0
box.delete_at(box.index(box.min))
empty_box += 1
end
break if count == m
end
end
puts empty_box