結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー shinshin
提出日時 2022-05-17 07:33:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 772 bytes
コンパイル時間 3,849 ms
コンパイル使用メモリ 73,420 KB
実行使用メモリ 49,692 KB
最終ジャッジ日時 2023-10-13 03:25:21
合計ジャッジ時間 6,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,256 KB
testcase_01 AC 43 ms
49,164 KB
testcase_02 AC 42 ms
49,288 KB
testcase_03 AC 43 ms
49,248 KB
testcase_04 AC 43 ms
49,244 KB
testcase_05 AC 42 ms
49,420 KB
testcase_06 AC 42 ms
49,184 KB
testcase_07 AC 43 ms
49,152 KB
testcase_08 AC 43 ms
49,104 KB
testcase_09 AC 42 ms
49,176 KB
testcase_10 AC 42 ms
49,200 KB
testcase_11 AC 42 ms
49,176 KB
testcase_12 AC 42 ms
49,328 KB
testcase_13 AC 43 ms
49,204 KB
testcase_14 AC 42 ms
49,240 KB
testcase_15 AC 43 ms
49,256 KB
testcase_16 AC 43 ms
49,264 KB
testcase_17 AC 43 ms
49,692 KB
testcase_18 AC 43 ms
49,132 KB
testcase_19 AC 42 ms
49,364 KB
testcase_20 AC 43 ms
49,184 KB
testcase_21 AC 43 ms
49,100 KB
testcase_22 AC 42 ms
49,264 KB
testcase_23 AC 43 ms
49,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class No47 {

	public static void main(String[] args) throws IOException{
		//ポケットを叩くとビスケットが2倍
		int N = Integer.parseInt(readStr()[0]) , s = 1 , count = 0;
		do {
			s = Math.min(s * 2, N);
			count += (s != 1 ? 1 : 0);
		}while(s < N);
		
		System.out.println(count);

	}
	
	public static String[] readStr() throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<>();

		do {
			list.add(br.readLine());
		}while(br.ready());

		br.close();

		String[] text = new String[list.size()];
		list.toArray(text);

		return text;

	}

}
0