結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
NiraCha
|
| 提出日時 | 2017-04-19 08:33:33 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 5,000 ms |
| コード長 | 270 bytes |
| 記録 | |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-05-12 23:00:06 |
| 合計ジャッジ時間 | 3,293 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
NiraCha