結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー keitamidokeitamido
提出日時 2017-06-12 08:07:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 74,088 KB
実行使用メモリ 57,620 KB
最終ジャッジ日時 2023-10-24 21:29:43
合計ジャッジ時間 5,853 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
57,304 KB
testcase_01 AC 109 ms
56,200 KB
testcase_02 AC 123 ms
57,620 KB
testcase_03 AC 125 ms
55,232 KB
testcase_04 AC 123 ms
57,548 KB
testcase_05 AC 123 ms
57,440 KB
testcase_06 AC 121 ms
57,376 KB
testcase_07 AC 119 ms
57,512 KB
testcase_08 AC 121 ms
57,584 KB
testcase_09 AC 121 ms
57,388 KB
testcase_10 AC 119 ms
57,308 KB
testcase_11 AC 120 ms
57,496 KB
testcase_12 AC 119 ms
57,272 KB
testcase_13 AC 111 ms
56,212 KB
testcase_14 AC 122 ms
57,404 KB
testcase_15 AC 123 ms
57,216 KB
testcase_16 AC 120 ms
57,284 KB
testcase_17 AC 120 ms
57,432 KB
testcase_18 AC 118 ms
55,412 KB
testcase_19 AC 121 ms
57,392 KB
testcase_20 AC 123 ms
57,536 KB
testcase_21 AC 120 ms
57,276 KB
testcase_22 AC 119 ms
57,436 KB
testcase_23 AC 124 ms
57,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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