結果

問題 No.5 数字のブロック
ユーザー riokuma0810
提出日時 2015-09-04 00:46:00
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 165 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-07-18 23:39:25
合計ジャッジ時間 4,381 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:13: warning: mismatched indentations at 'end' with 'else' at 10
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

l = gets.to_i
n = gets.to_i
w = gets.split.map(&:to_i)
s = 0
ii = 0
w.sort.each do |i|
    if s < l
    s += i
    ii += 1
    else
    p ii - 1
    break
  end
end
0