結果
問題 | No.5 数字のブロック |
ユーザー | aki |
提出日時 | 2016-12-04 11:26:30 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 100 ms / 5,000 ms |
コード長 | 279 bytes |
コンパイル時間 | 57 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-11-18 10:47:01 |
合計ジャッジ時間 | 4,309 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
コンパイルメッセージ
Syntax OK
ソースコード
width = gets.chomp.to_i block_count = gets.chomp.to_i blocks = gets.chomp.split(" ").map(&:to_i).sort! current_width = 0 blocks.each_with_index do |b, i| current_width += b if current_width > width puts i break elsif block_count == i+1 puts i + 1 end end