結果

問題 No.5 数字のブロック
ユーザー riokuma0810
提出日時 2015-09-04 00:49:53
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 142 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-07-18 23:39:49
合計ジャッジ時間 4,370 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: mismatched indentations at 'end' with 'if' at 7
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
  end
end

puts ii
0