結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー wf4n9wf4n9
提出日時 2017-10-12 17:57:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 437 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 74,888 KB
実行使用メモリ 54,584 KB
最終ジャッジ日時 2024-04-28 17:07:22
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
53,960 KB
testcase_01 AC 108 ms
52,732 KB
testcase_02 AC 122 ms
54,004 KB
testcase_03 AC 118 ms
54,064 KB
testcase_04 AC 123 ms
53,880 KB
testcase_05 AC 121 ms
54,060 KB
testcase_06 AC 119 ms
53,864 KB
testcase_07 AC 119 ms
53,736 KB
testcase_08 AC 118 ms
53,952 KB
testcase_09 AC 123 ms
53,944 KB
testcase_10 AC 122 ms
53,924 KB
testcase_11 AC 123 ms
54,004 KB
testcase_12 AC 105 ms
52,944 KB
testcase_13 AC 123 ms
53,756 KB
testcase_14 AC 118 ms
54,176 KB
testcase_15 AC 121 ms
54,004 KB
testcase_16 AC 126 ms
54,584 KB
testcase_17 AC 108 ms
52,964 KB
testcase_18 AC 109 ms
52,908 KB
testcase_19 AC 109 ms
54,128 KB
testcase_20 AC 122 ms
53,884 KB
testcase_21 AC 124 ms
54,000 KB
testcase_22 AC 125 ms
54,016 KB
testcase_23 AC 119 ms
54,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);

		int biscuitsQty = sc.nextInt();
		System.out.println(calcHitPocket(biscuitsQty));
	}

	public static int calcHitPocket(final int biscuitsQty) {
		int hitQty = 0;
		int currentBiscuitsQty = 1;

		while (currentBiscuitsQty < biscuitsQty) {
			currentBiscuitsQty *= 2;
			hitQty++;
		}
		return hitQty;
	}
}
0