結果

問題 No.5 数字のブロック
ユーザー SapphireSapphire
提出日時 2019-06-21 15:31:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 178 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,600 KB
実行使用メモリ 15,648 KB
最終ジャッジ日時 2023-08-26 09:23:01
合計ジャッジ時間 3,929 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,060 KB
testcase_01 AC 70 ms
15,176 KB
testcase_02 AC 68 ms
15,328 KB
testcase_03 AC 70 ms
15,440 KB
testcase_04 AC 74 ms
15,596 KB
testcase_05 AC 76 ms
15,552 KB
testcase_06 AC 75 ms
15,380 KB
testcase_07 AC 71 ms
15,352 KB
testcase_08 AC 74 ms
15,544 KB
testcase_09 AC 73 ms
15,160 KB
testcase_10 AC 75 ms
15,388 KB
testcase_11 AC 75 ms
15,360 KB
testcase_12 AC 75 ms
15,288 KB
testcase_13 AC 73 ms
15,356 KB
testcase_14 AC 68 ms
15,324 KB
testcase_15 AC 70 ms
15,080 KB
testcase_16 AC 73 ms
15,388 KB
testcase_17 AC 75 ms
15,584 KB
testcase_18 AC 76 ms
15,352 KB
testcase_19 AC 77 ms
15,648 KB
testcase_20 AC 74 ms
15,260 KB
testcase_21 AC 73 ms
15,288 KB
testcase_22 AC 74 ms
15,136 KB
testcase_23 AC 74 ms
15,332 KB
testcase_24 AC 73 ms
15,152 KB
testcase_25 AC 71 ms
15,024 KB
testcase_26 AC 75 ms
15,172 KB
testcase_27 AC 74 ms
15,128 KB
testcase_28 AC 72 ms
15,200 KB
testcase_29 AC 72 ms
15,508 KB
testcase_30 AC 70 ms
15,304 KB
testcase_31 AC 70 ms
15,024 KB
testcase_32 AC 70 ms
15,252 KB
testcase_33 AC 69 ms
15,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

size = gets.to_i
n = gets.to_i
ary = Array.new(gets.split.map &:to_i)
ary.sort!
sum = 0
num = 0
while ary.first && sum+ary.first<=size
  sum += ary.shift
  num += 1
end
puts num
0