結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー dazydazy
提出日時 2016-09-04 00:20:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 112 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 3,750 ms
コンパイル使用メモリ 73,964 KB
実行使用メモリ 53,988 KB
最終ジャッジ日時 2024-04-27 15:55:21
合計ジャッジ時間 6,311 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
52,948 KB
testcase_01 AC 112 ms
53,732 KB
testcase_02 AC 98 ms
52,652 KB
testcase_03 AC 104 ms
52,852 KB
testcase_04 AC 101 ms
52,800 KB
testcase_05 AC 107 ms
52,744 KB
testcase_06 AC 100 ms
52,788 KB
testcase_07 AC 112 ms
53,988 KB
testcase_08 AC 100 ms
53,924 KB
testcase_09 AC 112 ms
53,812 KB
testcase_10 AC 104 ms
52,660 KB
testcase_11 AC 96 ms
52,304 KB
testcase_12 AC 102 ms
53,008 KB
testcase_13 AC 101 ms
52,856 KB
testcase_14 AC 106 ms
52,792 KB
testcase_15 AC 103 ms
52,728 KB
testcase_16 AC 98 ms
52,860 KB
testcase_17 AC 109 ms
53,344 KB
testcase_18 AC 102 ms
52,768 KB
testcase_19 AC 99 ms
52,920 KB
testcase_20 AC 109 ms
53,060 KB
testcase_21 AC 101 ms
52,636 KB
testcase_22 AC 102 ms
52,740 KB
testcase_23 AC 100 ms
52,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        if (N < 1||N > 100000000) System.exit(1);

        int tap = 0;
        int tmp = 1;
        while (N >= tmp * 2){
            tmp *= 2;
            tap++;
        }
        N -= tmp;
        if (N!=0) tap++;
        System.out.println(tap);
    }
}
0