結果

問題 No.5 数字のブロック
ユーザー riokuma0810
提出日時 2015-09-04 00:46:52
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 166 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-07-18 23:39:30
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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