結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-13 22:55:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 3,406 ms
コンパイル使用メモリ 72,464 KB
実行使用メモリ 57,664 KB
最終ジャッジ日時 2023-09-10 19:37:43
合計ジャッジ時間 7,071 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,444 KB
testcase_01 AC 120 ms
55,832 KB
testcase_02 AC 122 ms
56,208 KB
testcase_03 AC 122 ms
55,716 KB
testcase_04 AC 120 ms
55,444 KB
testcase_05 AC 121 ms
56,012 KB
testcase_06 AC 119 ms
55,836 KB
testcase_07 AC 120 ms
55,792 KB
testcase_08 AC 120 ms
55,584 KB
testcase_09 AC 120 ms
55,712 KB
testcase_10 AC 124 ms
55,516 KB
testcase_11 AC 119 ms
55,924 KB
testcase_12 AC 121 ms
55,852 KB
testcase_13 AC 120 ms
56,056 KB
testcase_14 AC 120 ms
55,760 KB
testcase_15 AC 120 ms
55,900 KB
testcase_16 AC 123 ms
55,584 KB
testcase_17 AC 121 ms
55,816 KB
testcase_18 AC 121 ms
57,664 KB
testcase_19 AC 120 ms
55,644 KB
testcase_20 AC 119 ms
55,820 KB
testcase_21 AC 120 ms
55,760 KB
testcase_22 AC 120 ms
55,880 KB
testcase_23 AC 120 ms
55,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class PocketBiscuit{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean flg = true;
        if(N == 1){
            System.out.println(0);
            flg = false;
        }
        int num_bis = 1;
        int num_hit = 0;
        while(flg){
            if(num_bis*2<N){
                num_bis = num_bis*2;
                num_hit++;
            }else{
                System.out.println(num_hit+1);
                break;
            }
        }
    }
}
0