結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-28 13:19:41 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 312 bytes |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-11-22 03:15:21 |
| 合計ジャッジ時間 | 6,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 4 WA * 26 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n, m = gets.chomp.split(" ").map(&:to_i)
lists = gets.chomp.split(" ").map(&:to_i)
i = -1
while m > -1 do
#lists[i] == 0 ? i += 1 : lists[i] -= 1
lists[i] -= 1
if lists[i] == 0
i += 1
#puts "list#{lists[i - 1]}"
#puts i
end
m -= 1;
end
count = 0
lists.each{|list| count += 1 if list == 0}
puts count