結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-06-26 14:02:03 |
言語 | Ruby (3.4.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 359 bytes |
コンパイル時間 | 58 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-11-24 03:23:17 |
合計ジャッジ時間 | 4,053 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 WA * 2 |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - num Syntax OK
ソースコード
big_w = gets.to_i num = gets.to_i n_w = gets.to_s n_w2 = n_w.split(" ") n_w2.map!(&:to_i) i = 0 ans = 0 n_w2.sort.each_with_index do |a, index| if big_w >= n_w2.inject(:+) ans = n_w2.length elsif i + a == big_w ans = index + 1 elsif i + a > big_w ans = index break else i += a end end puts ans