結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Daigo HIROOKA
提出日時 2018-05-13 22:55:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 3,355 ms
コンパイル使用メモリ 74,316 KB
実行使用メモリ 41,568 KB
最終ジャッジ日時 2024-06-28 10:44:45
合計ジャッジ時間 7,079 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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