結果

問題 No.5 数字のブロック
ユーザー fungsi
提出日時 2025-09-09 18:37:41
言語 Crystal
(1.14.0)
結果
RE  
実行時間 -
コード長 251 bytes
コンパイル時間 19,334 ms
コンパイル使用メモリ 308,328 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-09 18:38:02
合計ジャッジ時間 12,026 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

l, n = gets.not_nil!.split.map(&.to_i)

weights = [] of Int32
while weights.size < n
  weights.concat gets.not_nil!.split.map(&.to_i)
end

weights.sort!

sum = 0
count = 0

weights.each do |w|
  sum += w
  break if sum > l
  count += 1
end

puts count
0