結果

問題 No.5 数字のブロック
ユーザー yuki__ninoaiyuki__ninoai
提出日時 2016-02-16 20:39:53
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 189 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 11,700 KB
実行使用メモリ 16,608 KB
最終ジャッジ日時 2023-10-22 06:01:05
合計ジャッジ時間 4,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,064 KB
testcase_01 AC 88 ms
16,064 KB
testcase_02 RE -
testcase_03 AC 93 ms
16,324 KB
testcase_04 AC 93 ms
16,324 KB
testcase_05 AC 96 ms
16,324 KB
testcase_06 AC 91 ms
16,324 KB
testcase_07 AC 91 ms
16,324 KB
testcase_08 AC 92 ms
16,324 KB
testcase_09 AC 90 ms
16,064 KB
testcase_10 AC 93 ms
16,324 KB
testcase_11 AC 92 ms
16,324 KB
testcase_12 AC 92 ms
16,324 KB
testcase_13 AC 94 ms
16,320 KB
testcase_14 AC 87 ms
16,064 KB
testcase_15 AC 89 ms
16,064 KB
testcase_16 AC 93 ms
16,324 KB
testcase_17 AC 93 ms
16,604 KB
testcase_18 AC 92 ms
16,336 KB
testcase_19 AC 92 ms
16,608 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 88 ms
16,064 KB
testcase_24 AC 88 ms
16,064 KB
testcase_25 AC 87 ms
16,064 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 91 ms
16,324 KB
testcase_30 AC 90 ms
16,064 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - num
Main.rb:6: warning: assigned but unused variable - count
Syntax OK

ソースコード

diff #

length = gets.to_i #16
num = gets.to_i #3
s = gets.chomp.split(" ").map(&:to_i).sort #[5, 7, 10]

sum = 0
count = 0
i = 0

while sum <= length
  sum = sum + s[i]
  i = i + 1
end

puts i - 1
0