結果
問題 | No.5 数字のブロック |
ユーザー | NiraCha |
提出日時 | 2017-04-19 08:33:33 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 97 ms / 5,000 ms |
コード長 | 270 bytes |
コンパイル時間 | 47 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-11-18 10:59:55 |
合計ジャッジ時間 | 4,099 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
コンパイルメッセージ
Main.rb:12: warning: mismatched indentations at 'else' with 'if' at 9 Main.rb:2: warning: assigned but unused variable - n Syntax OK
ソースコード
width = gets.to_i n = gets.to_i array = gets.split.map(&:to_i).sort # 入ったブロックの数 count = 0 # 小さいブロックから箱に入れて箱の幅更新 array.each do |w| if width >= w then width -= w count += 1 else break end end puts count