結果

問題 No.5 数字のブロック
ユーザー riokuma0810riokuma0810
提出日時 2015-08-15 22:36:21
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 208 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 15,740 KB
最終ジャッジ日時 2023-09-25 12:10:49
合計ジャッジ時間 4,273 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,128 KB
testcase_01 AC 83 ms
15,040 KB
testcase_02 WA -
testcase_03 AC 83 ms
15,380 KB
testcase_04 AC 83 ms
15,524 KB
testcase_05 WA -
testcase_06 AC 84 ms
15,348 KB
testcase_07 AC 84 ms
15,556 KB
testcase_08 AC 84 ms
15,480 KB
testcase_09 AC 83 ms
15,084 KB
testcase_10 AC 84 ms
15,556 KB
testcase_11 AC 83 ms
15,500 KB
testcase_12 AC 82 ms
15,288 KB
testcase_13 AC 84 ms
15,488 KB
testcase_14 AC 78 ms
15,304 KB
testcase_15 WA -
testcase_16 AC 86 ms
15,316 KB
testcase_17 AC 86 ms
15,740 KB
testcase_18 AC 84 ms
15,572 KB
testcase_19 AC 85 ms
15,700 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 80 ms
15,048 KB
testcase_24 AC 78 ms
15,156 KB
testcase_25 AC 81 ms
15,112 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

l = gets.chomp.to_i
n = gets.chomp.to_i
ary = []
ary1 = []
a = 0
b = 0

ary = gets.chomp.split

ary.each do |i|
ary1 << i.to_i
end

ary1.sort.each do |i|
  if a < l
    a += i
    b += 1
  end
end

puts b - 1
0