結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー enuo-9enuo-9
提出日時 2016-09-15 14:30:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 2,757 ms
コンパイル使用メモリ 75,080 KB
実行使用メモリ 41,588 KB
最終ジャッジ日時 2024-04-28 13:49:35
合計ジャッジ時間 6,181 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
40,084 KB
testcase_01 AC 99 ms
39,780 KB
testcase_02 AC 101 ms
40,220 KB
testcase_03 AC 115 ms
41,296 KB
testcase_04 AC 118 ms
41,152 KB
testcase_05 AC 113 ms
41,208 KB
testcase_06 AC 110 ms
41,328 KB
testcase_07 AC 110 ms
41,432 KB
testcase_08 AC 99 ms
40,448 KB
testcase_09 AC 101 ms
40,348 KB
testcase_10 AC 110 ms
41,264 KB
testcase_11 AC 102 ms
40,352 KB
testcase_12 AC 104 ms
40,704 KB
testcase_13 AC 106 ms
41,160 KB
testcase_14 AC 101 ms
39,916 KB
testcase_15 AC 103 ms
40,856 KB
testcase_16 AC 107 ms
41,588 KB
testcase_17 AC 109 ms
41,412 KB
testcase_18 AC 109 ms
41,588 KB
testcase_19 AC 116 ms
41,028 KB
testcase_20 AC 100 ms
40,084 KB
testcase_21 AC 111 ms
41,112 KB
testcase_22 AC 114 ms
41,464 KB
testcase_23 AC 105 ms
40,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No047 {
	public static void main(String args[]){
		//2.4.8.16.32.64.128....and 1

		Scanner sc = new Scanner(System.in);
		//欲しい数量
		int total = 0;
		//ビスケット数
		int biscuit = 1;
		int cnt = 0;

		total = sc.nextInt();

		//欲しい数量を上回ったらループ脱出
		//倍々していき、欲しい数量オーバーする一歩手前+幾つか取り出して倍にするで
		//任意の数に設定できるため
		while(biscuit<total){
			biscuit = biscuit*2;
			cnt++;
		}
		System.out.println(cnt);

	}
}
0