結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー l1267976l1267976
提出日時 2017-03-08 21:49:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 3,248 ms
コンパイル使用メモリ 72,428 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-09-06 00:31:00
合計ジャッジ時間 7,265 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,200 KB
testcase_01 AC 117 ms
56,116 KB
testcase_02 AC 119 ms
55,844 KB
testcase_03 AC 118 ms
56,284 KB
testcase_04 AC 119 ms
55,512 KB
testcase_05 AC 116 ms
56,496 KB
testcase_06 AC 122 ms
55,996 KB
testcase_07 AC 124 ms
55,732 KB
testcase_08 AC 125 ms
55,700 KB
testcase_09 AC 124 ms
56,148 KB
testcase_10 AC 126 ms
56,184 KB
testcase_11 AC 124 ms
55,732 KB
testcase_12 AC 120 ms
56,240 KB
testcase_13 AC 118 ms
55,884 KB
testcase_14 AC 127 ms
55,760 KB
testcase_15 AC 116 ms
56,124 KB
testcase_16 AC 118 ms
56,004 KB
testcase_17 AC 116 ms
55,904 KB
testcase_18 AC 119 ms
55,912 KB
testcase_19 AC 122 ms
55,808 KB
testcase_20 AC 119 ms
55,752 KB
testcase_21 AC 119 ms
55,992 KB
testcase_22 AC 121 ms
56,220 KB
testcase_23 AC 124 ms
55,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No47 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int result = doHit(1, n, 0);
        System.out.println(result);

        sc.close();
    }

    private static int doHit(int biskets, int want, int hitHnt) {
        if (biskets >= want) {
            return hitHnt;
        }

        hitHnt++;

        return doHit(biskets * 2, want, hitHnt);
    }

}
0