結果

問題 No.5 数字のブロック
ユーザー nikuzukinikuzuki
提出日時 2015-11-15 00:04:44
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 15,712 KB
最終ジャッジ日時 2023-10-11 17:45:56
合計ジャッジ時間 4,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,128 KB
testcase_01 AC 81 ms
15,140 KB
testcase_02 WA -
testcase_03 AC 85 ms
15,340 KB
testcase_04 AC 85 ms
15,500 KB
testcase_05 AC 85 ms
15,596 KB
testcase_06 AC 85 ms
15,432 KB
testcase_07 AC 84 ms
15,588 KB
testcase_08 AC 85 ms
15,284 KB
testcase_09 AC 84 ms
15,316 KB
testcase_10 AC 86 ms
15,624 KB
testcase_11 AC 84 ms
15,648 KB
testcase_12 AC 85 ms
15,384 KB
testcase_13 AC 86 ms
15,384 KB
testcase_14 AC 81 ms
15,244 KB
testcase_15 AC 82 ms
15,116 KB
testcase_16 AC 86 ms
15,364 KB
testcase_17 AC 88 ms
15,664 KB
testcase_18 AC 87 ms
15,384 KB
testcase_19 AC 86 ms
15,712 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 83 ms
15,288 KB
testcase_24 AC 82 ms
15,124 KB
testcase_25 AC 82 ms
15,332 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 86 ms
15,428 KB
testcase_30 AC 88 ms
15,268 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

l = gets.chomp.to_i # 箱の幅
n = gets.chomp.to_i # ブロックの数
w = gets.chomp      # 書くブロックの幅
num = 0             # 幅に入る箱の個数

array = w.split(" ").map(&:to_i).sort

for i in 0..n

  if (l - array[i].to_i) >= 0
    l = l - array[i].to_i
    num += 1
  else
    break
  end
end

print num
0