結果

問題 No.156 キャンディー・ボックス
ユーザー harhogefooharhogefoo
提出日時 2016-10-09 20:39:17
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,873 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 15,320 KB
最終ジャッジ日時 2023-09-19 03:15:57
合計ジャッジ時間 9,519 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,056 KB
testcase_01 AC 85 ms
15,220 KB
testcase_02 AC 83 ms
15,292 KB
testcase_03 AC 89 ms
15,276 KB
testcase_04 AC 84 ms
15,212 KB
testcase_05 AC 132 ms
15,092 KB
testcase_06 AC 188 ms
15,092 KB
testcase_07 AC 164 ms
15,056 KB
testcase_08 AC 152 ms
15,120 KB
testcase_09 AC 130 ms
15,144 KB
testcase_10 AC 162 ms
15,100 KB
testcase_11 AC 127 ms
15,276 KB
testcase_12 AC 185 ms
15,288 KB
testcase_13 AC 151 ms
15,256 KB
testcase_14 AC 129 ms
15,268 KB
testcase_15 AC 157 ms
15,160 KB
testcase_16 AC 133 ms
15,160 KB
testcase_17 AC 151 ms
15,008 KB
testcase_18 AC 109 ms
15,160 KB
testcase_19 AC 113 ms
15,312 KB
testcase_20 AC 86 ms
15,320 KB
testcase_21 AC 92 ms
15,284 KB
testcase_22 AC 106 ms
15,012 KB
testcase_23 AC 95 ms
15,132 KB
testcase_24 AC 85 ms
15,252 KB
testcase_25 AC 84 ms
15,012 KB
testcase_26 AC 85 ms
15,280 KB
testcase_27 AC 85 ms
15,160 KB
testcase_28 AC 85 ms
15,096 KB
testcase_29 AC 87 ms
15,156 KB
testcase_30 AC 365 ms
15,136 KB
testcase_31 AC 180 ms
15,144 KB
testcase_32 AC 1,873 ms
15,056 KB
testcase_33 AC 1,871 ms
15,300 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n, m = gets.chomp.split(" ").map(&:to_i)
c_ary = gets.chomp.split(" ").map(&:to_i)

count = 0
m.times do |i|
  min_index = c_ary.index(c_ary.min)
  c_ary[min_index] -= 1
  if c_ary[min_index] == 0
    c_ary.delete_at(min_index)
    count += 1
  end
end
puts count
0