結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー matsuyoshi30
提出日時 2016-02-04 18:52:05
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 1,798 ms
コンパイル使用メモリ 74,504 KB
実行使用メモリ 41,184 KB
最終ジャッジ日時 2024-09-21 20:31:40
合計ジャッジ時間 5,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int num = 1;
		int counts = 0;

		while(true) {
			num *= 2;
			if(num > n) {
				break;
			}
			counts++;
		}

		int w = n - (num / 2);
		if(w != 0) {
			counts++;
		}

		System.out.println(counts);
	}
}
0