結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー sasakkisasakki
提出日時 2016-04-08 15:26:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 74,396 KB
実行使用メモリ 54,288 KB
最終ジャッジ日時 2024-04-14 23:27:22
合計ジャッジ時間 5,870 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
53,888 KB
testcase_01 AC 124 ms
54,188 KB
testcase_02 AC 126 ms
54,232 KB
testcase_03 AC 126 ms
54,256 KB
testcase_04 AC 128 ms
54,104 KB
testcase_05 AC 127 ms
54,104 KB
testcase_06 AC 127 ms
53,892 KB
testcase_07 AC 126 ms
53,952 KB
testcase_08 AC 127 ms
54,164 KB
testcase_09 AC 128 ms
54,288 KB
testcase_10 AC 125 ms
53,912 KB
testcase_11 AC 125 ms
53,864 KB
testcase_12 AC 127 ms
54,008 KB
testcase_13 AC 126 ms
54,248 KB
testcase_14 AC 125 ms
54,116 KB
testcase_15 AC 126 ms
54,180 KB
testcase_16 AC 126 ms
53,896 KB
testcase_17 AC 128 ms
54,136 KB
testcase_18 AC 127 ms
54,012 KB
testcase_19 AC 127 ms
54,028 KB
testcase_20 AC 126 ms
54,212 KB
testcase_21 AC 126 ms
54,084 KB
testcase_22 AC 129 ms
54,120 KB
testcase_23 AC 126 ms
54,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no47{
    public static void main(String args[]){
	Scanner sc = new Scanner(System.in);

	int N = Integer.parseInt(sc.next());

	int biscuits = 1;

	int num = 0;

	while(true){
	    if( biscuits == N){
		break;
	    }
	    else if( biscuits * 2 <= N ){
		biscuits *= 2;
		num++;
	    }
	    else{
		num++;
		break;
	    }
	}

	System.out.println(num);

    }
}
0