結果

問題 No.5 数字のブロック
ユーザー ______
提出日時 2018-02-17 10:24:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 15,612 KB
最終ジャッジ日時 2023-09-06 17:41:54
合計ジャッジ時間 4,686 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,080 KB
testcase_01 AC 81 ms
15,120 KB
testcase_02 WA -
testcase_03 AC 87 ms
15,572 KB
testcase_04 AC 90 ms
15,612 KB
testcase_05 AC 85 ms
15,308 KB
testcase_06 AC 84 ms
15,308 KB
testcase_07 AC 85 ms
15,356 KB
testcase_08 AC 84 ms
15,300 KB
testcase_09 AC 85 ms
15,288 KB
testcase_10 AC 84 ms
15,296 KB
testcase_11 AC 83 ms
15,144 KB
testcase_12 AC 87 ms
15,556 KB
testcase_13 AC 87 ms
15,388 KB
testcase_14 AC 84 ms
15,036 KB
testcase_15 AC 83 ms
15,248 KB
testcase_16 AC 89 ms
15,308 KB
testcase_17 AC 86 ms
15,420 KB
testcase_18 AC 89 ms
15,388 KB
testcase_19 AC 89 ms
15,560 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 82 ms
15,164 KB
testcase_24 AC 82 ms
15,160 KB
testcase_25 AC 82 ms
15,088 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 85 ms
15,228 KB
testcase_30 AC 83 ms
15,144 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - box_num
Syntax OK

ソースコード

diff #

box_width = gets.to_i
box_num = gets.to_i
blocks = gets.split.map(&:to_i)
count_box_num = 0

blocks.sort!

blocks.map{|s|
    box_width -= s
    if box_width < 0
        puts count_box_num
        return
    else
        count_box_num += 1
    end
}
0