結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 16:11:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 3,741 ms
コンパイル使用メモリ 71,544 KB
実行使用メモリ 58,168 KB
最終ジャッジ日時 2023-09-09 11:44:06
合計ジャッジ時間 8,036 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 121 ms
55,772 KB
testcase_02 AC 120 ms
55,940 KB
testcase_03 AC 122 ms
56,348 KB
testcase_04 WA -
testcase_05 AC 121 ms
55,992 KB
testcase_06 AC 122 ms
55,832 KB
testcase_07 AC 123 ms
56,028 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 119 ms
56,040 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		//System.out.println("数字");
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		scanner.close();
		int n = 0;
		int y;
		boolean flag = true;
		// while文の繰り返し回数を20未満とした
		while(flag) {
			y = N - (int) Math.pow(2, n);
			if(y <= 0) {
				break;
			}
			if(n > 20) {
				flag = false;
			}
			n++;
		}
		System.out.println(n);
	}
}
0