結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー estece1estece1
提出日時 2023-06-05 18:46:25
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,840 ms / 5,000 ms
コード長 203 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 15,332 KB
最終ジャッジ日時 2023-08-28 09:39:43
合計ジャッジ時間 25,268 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,840 ms
15,280 KB
testcase_01 AC 79 ms
15,140 KB
testcase_02 AC 78 ms
15,152 KB
testcase_03 AC 79 ms
15,140 KB
testcase_04 AC 1,483 ms
15,152 KB
testcase_05 AC 81 ms
15,036 KB
testcase_06 AC 81 ms
15,280 KB
testcase_07 AC 81 ms
15,140 KB
testcase_08 AC 1,804 ms
15,316 KB
testcase_09 AC 302 ms
15,140 KB
testcase_10 AC 2,439 ms
15,232 KB
testcase_11 AC 1,368 ms
15,208 KB
testcase_12 AC 1,125 ms
15,148 KB
testcase_13 AC 931 ms
15,048 KB
testcase_14 AC 1,899 ms
15,220 KB
testcase_15 AC 331 ms
15,128 KB
testcase_16 AC 610 ms
15,332 KB
testcase_17 AC 826 ms
15,124 KB
testcase_18 AC 282 ms
15,144 KB
testcase_19 AC 121 ms
15,128 KB
testcase_20 AC 670 ms
15,072 KB
testcase_21 AC 423 ms
15,076 KB
testcase_22 AC 850 ms
15,160 KB
testcase_23 AC 1,648 ms
15,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

n = gets.to_i
c = 1
t = 0
d = 0
while c < n
    if (c - d) * 2 + d <= n
        t += 1
        c = (c - d) * 2 + d
        d = 0
        next
    end
    d += 1
end
puts t
0