結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー keitamido
提出日時 2017-06-12 08:07:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 2,184 ms
コンパイル使用メモリ 74,684 KB
実行使用メモリ 54,240 KB
最終ジャッジ日時 2024-09-24 16:41:59
合計ジャッジ時間 6,335 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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