結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,392 KB
testcase_01 AC 80 ms
15,292 KB
testcase_02 WA -
testcase_03 AC 84 ms
15,308 KB
testcase_04 AC 85 ms
15,312 KB
testcase_05 WA -
testcase_06 AC 86 ms
15,436 KB
testcase_07 AC 86 ms
15,564 KB
testcase_08 AC 85 ms
15,524 KB
testcase_09 AC 85 ms
15,136 KB
testcase_10 AC 86 ms
15,448 KB
testcase_11 AC 83 ms
15,548 KB
testcase_12 AC 85 ms
15,348 KB
testcase_13 AC 86 ms
15,504 KB
testcase_14 AC 81 ms
15,312 KB
testcase_15 WA -
testcase_16 AC 86 ms
15,364 KB
testcase_17 AC 86 ms
15,452 KB
testcase_18 AC 84 ms
15,428 KB
testcase_19 AC 87 ms
15,748 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 82 ms
15,080 KB
testcase_24 AC 81 ms
15,292 KB
testcase_25 AC 81 ms
15,236 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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]) > 0
    l = l - array[i].to_i
    num += 1
  else
    break
  end
end

print num
0