結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー jonki324jonki324
提出日時 2018-06-05 14:31:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 71,300 KB
実行使用メモリ 56,332 KB
最終ジャッジ日時 2023-09-12 22:24:52
合計ジャッジ時間 5,810 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,944 KB
testcase_01 AC 120 ms
55,776 KB
testcase_02 AC 119 ms
55,472 KB
testcase_03 AC 119 ms
55,716 KB
testcase_04 AC 120 ms
55,972 KB
testcase_05 AC 122 ms
55,896 KB
testcase_06 AC 122 ms
55,516 KB
testcase_07 AC 122 ms
55,756 KB
testcase_08 AC 121 ms
55,964 KB
testcase_09 AC 122 ms
56,036 KB
testcase_10 AC 121 ms
55,828 KB
testcase_11 AC 121 ms
56,028 KB
testcase_12 AC 122 ms
55,812 KB
testcase_13 AC 121 ms
56,332 KB
testcase_14 AC 120 ms
55,680 KB
testcase_15 AC 119 ms
55,700 KB
testcase_16 AC 119 ms
56,108 KB
testcase_17 AC 118 ms
55,536 KB
testcase_18 AC 124 ms
55,888 KB
testcase_19 AC 121 ms
55,704 KB
testcase_20 AC 120 ms
56,240 KB
testcase_21 AC 121 ms
55,860 KB
testcase_22 AC 119 ms
55,752 KB
testcase_23 AC 124 ms
55,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int b = 1;
        int cnt = 0;
        while (true) {
            if (b >= n) {
                break;
            }
            b *= 2;
            cnt++;
        }
        System.out.println(cnt);
        scan.close();
    }
}
0