結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー S1hoS1ho
提出日時 2017-02-20 16:42:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 3,413 ms
コンパイル使用メモリ 72,528 KB
実行使用メモリ 56,340 KB
最終ジャッジ日時 2023-08-28 19:47:19
合計ジャッジ時間 6,806 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,184 KB
testcase_01 AC 114 ms
55,832 KB
testcase_02 AC 116 ms
56,048 KB
testcase_03 AC 116 ms
55,480 KB
testcase_04 AC 115 ms
56,100 KB
testcase_05 AC 115 ms
55,984 KB
testcase_06 AC 115 ms
55,888 KB
testcase_07 AC 115 ms
56,112 KB
testcase_08 AC 116 ms
56,088 KB
testcase_09 AC 116 ms
55,928 KB
testcase_10 AC 117 ms
55,716 KB
testcase_11 AC 116 ms
55,488 KB
testcase_12 AC 116 ms
55,824 KB
testcase_13 AC 117 ms
55,864 KB
testcase_14 AC 116 ms
56,116 KB
testcase_15 AC 116 ms
55,892 KB
testcase_16 AC 116 ms
56,104 KB
testcase_17 AC 116 ms
56,032 KB
testcase_18 AC 116 ms
56,340 KB
testcase_19 AC 116 ms
55,792 KB
testcase_20 AC 117 ms
55,956 KB
testcase_21 AC 114 ms
55,728 KB
testcase_22 AC 115 ms
56,240 KB
testcase_23 AC 117 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class WonderPocket {

    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        int n = scanner.nextInt();
        
        int bis = 1;
        
        int count = 0;
        
        //オーバーしない数まで二倍していく
        while((bis *= 2) <= n){
            
            count++;
                    
        }
        
        if(bis/2 == n){
            System.out.println(count);
        }else{
            count++;
            System.out.println(count);
        }
        
    }
}
0