結果

問題 No.5 数字のブロック
ユーザー nikuzukinikuzuki
提出日時 2015-11-15 00:06:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 11,216 KB
実行使用メモリ 15,608 KB
最終ジャッジ日時 2023-08-11 14:19:13
合計ジャッジ時間 4,327 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,064 KB
testcase_01 AC 83 ms
15,068 KB
testcase_02 AC 78 ms
15,112 KB
testcase_03 AC 82 ms
15,324 KB
testcase_04 AC 81 ms
15,332 KB
testcase_05 AC 83 ms
15,540 KB
testcase_06 AC 82 ms
15,420 KB
testcase_07 AC 83 ms
15,484 KB
testcase_08 AC 84 ms
15,456 KB
testcase_09 AC 81 ms
15,268 KB
testcase_10 AC 84 ms
15,352 KB
testcase_11 AC 82 ms
15,544 KB
testcase_12 AC 82 ms
15,332 KB
testcase_13 AC 83 ms
15,484 KB
testcase_14 AC 79 ms
15,112 KB
testcase_15 AC 80 ms
15,136 KB
testcase_16 AC 84 ms
15,556 KB
testcase_17 AC 82 ms
15,440 KB
testcase_18 AC 83 ms
15,412 KB
testcase_19 AC 82 ms
15,608 KB
testcase_20 AC 77 ms
15,064 KB
testcase_21 AC 78 ms
15,116 KB
testcase_22 AC 80 ms
15,164 KB
testcase_23 AC 81 ms
15,008 KB
testcase_24 AC 81 ms
15,284 KB
testcase_25 AC 79 ms
15,216 KB
testcase_26 AC 78 ms
15,208 KB
testcase_27 AC 78 ms
15,200 KB
testcase_28 AC 77 ms
15,280 KB
testcase_29 AC 81 ms
15,372 KB
testcase_30 AC 81 ms
15,100 KB
testcase_31 AC 79 ms
15,052 KB
testcase_32 AC 79 ms
15,168 KB
testcase_33 AC 79 ms
15,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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-1

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

print num
0