結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー nihi9119nihi9119
提出日時 2017-06-16 18:09:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 1,410 bytes
コンパイル時間 3,315 ms
コンパイル使用メモリ 74,656 KB
実行使用メモリ 54,140 KB
最終ジャッジ日時 2024-04-08 13:44:30
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
54,112 KB
testcase_01 AC 52 ms
54,112 KB
testcase_02 AC 52 ms
54,120 KB
testcase_03 AC 52 ms
54,124 KB
testcase_04 AC 52 ms
54,112 KB
testcase_05 AC 51 ms
54,124 KB
testcase_06 AC 53 ms
54,116 KB
testcase_07 AC 53 ms
54,124 KB
testcase_08 AC 52 ms
54,120 KB
testcase_09 AC 51 ms
54,136 KB
testcase_10 AC 54 ms
54,116 KB
testcase_11 AC 52 ms
54,128 KB
testcase_12 AC 53 ms
54,112 KB
testcase_13 AC 53 ms
54,140 KB
testcase_14 AC 52 ms
54,116 KB
testcase_15 AC 59 ms
54,124 KB
testcase_16 AC 52 ms
54,116 KB
testcase_17 AC 52 ms
52,040 KB
testcase_18 AC 54 ms
54,128 KB
testcase_19 AC 52 ms
54,124 KB
testcase_20 AC 52 ms
54,116 KB
testcase_21 AC 53 ms
54,116 KB
testcase_22 AC 52 ms
54,124 KB
testcase_23 AC 53 ms
54,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test7;

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

/**
 * No.47 ポケットを叩くとビスケットが2倍
 * http://yukicoder.me/problems/89
 */

public class Question_21_0616 {

	final static int MAX = 1;
	final static int MIN = (int)Math.pow(10, 8);

	public static void main(String[] args) {

		InputStreamReader re = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(re);

		try {
			int result = Integer.parseInt(br.readLine());
			int Biscuits = 1;
			int count = 0;

			while (Biscuits < result) {
				Biscuits = Biscuits * 2;
				count++;
			}
			System.out.println(count);

		} catch (NumberFormatException e){
			System.out.println("数字を入力して下さい");
		} catch (IOException e) {
			System.out.println("エラーが発生しました");
		} finally {
			try {
				re.close();
				br.close();
			} catch (IOException e) {
				System.out.println("InputStreamReader、BufferedReaderクローズ中にエラーが発生しました");
			}
		}
	}

	/**
	 * 有効値判定
	 * @param input 判定するもの
	 * @param max 最大値
	 * @param min 最小値
	 * @return 範囲内ならtrue,範囲外ならfalseを返す
	 */
	private static boolean NumJudg(int input, int min, int max) {
		Boolean result = false;
		if (min <= input && input <= max) {
			result = true;
		}
		return result;
	}

}
0