結果

問題 No.156 キャンディー・ボックス
ユーザー rky
提出日時 2017-11-06 00:34:03
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-24 02:59:57
合計ジャッジ時間 5,403 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 4 WA * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n, m = gets.chomp.split(" ").map(&:to_i)
lists = gets.chomp.split(" ").map(&:to_i)
i = -1

while m > -1 do
	lists[i] -= 1
	if lists[i] == 0
		i += 1
	end
	m -= 1;
end

count = 0
lists.each{|list| count += 1 if list == 0}
puts count
0