結果
| 問題 | 
                            No.5 数字のブロック
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-07-10 17:53:33 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 99 ms / 5,000 ms | 
| コード長 | 230 bytes | 
| コンパイル時間 | 386 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 12,544 KB | 
| 最終ジャッジ日時 | 2024-10-15 17:35:49 | 
| 合計ジャッジ時間 | 5,016 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 34 | 
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n Syntax OK
ソースコード
def main
  l = gets.to_i
  n = gets.to_i
  ws = gets.split.map(&:to_i)
  cnt = 0
  total = 0
  ws.sort!
  while !ws.empty?
    cur = ws.shift
    break if l < total + cur
    cnt += 1
    total += cur
  end
  cnt
end
puts main