結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Koketti1Koketti1
提出日時 2017-02-04 17:21:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 2,147 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-08-25 20:12:52
合計ジャッジ時間 6,180 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,060 KB
testcase_01 AC 121 ms
55,476 KB
testcase_02 AC 121 ms
54,472 KB
testcase_03 AC 122 ms
56,152 KB
testcase_04 AC 121 ms
56,472 KB
testcase_05 AC 121 ms
55,848 KB
testcase_06 AC 122 ms
55,968 KB
testcase_07 AC 122 ms
55,720 KB
testcase_08 AC 121 ms
55,728 KB
testcase_09 AC 122 ms
55,728 KB
testcase_10 AC 124 ms
56,208 KB
testcase_11 AC 121 ms
55,952 KB
testcase_12 AC 121 ms
56,040 KB
testcase_13 AC 123 ms
55,952 KB
testcase_14 AC 124 ms
55,952 KB
testcase_15 AC 121 ms
56,188 KB
testcase_16 AC 124 ms
55,480 KB
testcase_17 AC 121 ms
55,984 KB
testcase_18 AC 120 ms
56,288 KB
testcase_19 AC 119 ms
55,712 KB
testcase_20 AC 120 ms
55,780 KB
testcase_21 AC 122 ms
55,748 KB
testcase_22 AC 122 ms
55,888 KB
testcase_23 AC 121 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		boolean B = false;
		int ans = 0;
		
		while(A/2 != 0){
			if(A % 2 == 1) B = true;
			A = A/2;
			ans++;
		}
		if(B) ans++;
		System.out.println(ans);
		scanner.close();
	}
}
0