結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Koketti1
提出日時 2017-02-04 17:21:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 2,399 ms
コンパイル使用メモリ 74,132 KB
実行使用メモリ 41,328 KB
最終ジャッジ日時 2024-12-24 06:16:51
合計ジャッジ時間 6,831 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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