結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-13 22:53:04
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 551 bytes
コンパイル時間 3,968 ms
コンパイル使用メモリ 72,596 KB
実行使用メモリ 58,092 KB
最終ジャッジ日時 2023-09-10 19:37:29
合計ジャッジ時間 8,275 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
58,092 KB
testcase_01 AC 121 ms
55,960 KB
testcase_02 AC 121 ms
56,236 KB
testcase_03 AC 119 ms
55,876 KB
testcase_04 AC 118 ms
56,384 KB
testcase_05 RE -
testcase_06 AC 118 ms
56,352 KB
testcase_07 AC 122 ms
56,040 KB
testcase_08 AC 121 ms
56,184 KB
testcase_09 AC 120 ms
56,172 KB
testcase_10 AC 122 ms
55,852 KB
testcase_11 AC 119 ms
56,320 KB
testcase_12 AC 118 ms
56,004 KB
testcase_13 AC 118 ms
55,444 KB
testcase_14 AC 118 ms
56,236 KB
testcase_15 AC 120 ms
55,960 KB
testcase_16 AC 120 ms
55,996 KB
testcase_17 AC 121 ms
56,588 KB
testcase_18 AC 120 ms
55,720 KB
testcase_19 AC 120 ms
55,768 KB
testcase_20 AC 122 ms
56,036 KB
testcase_21 AC 120 ms
55,840 KB
testcase_22 AC 121 ms
55,856 KB
testcase_23 AC 121 ms
55,840 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();
        if(N == 1){
            System.out.println(0);
            System.exit(1);
        }
        int num_bis = 1;
        int num_hit = 0;
        while(true){
            if(num_bis*2<N){
                num_bis = num_bis*2;
                num_hit++;
            }else{
                System.out.println(num_hit+1);
                break;
            }
        }
    }
}
0