結果

問題 No.169 何分かかるの!?
ユーザー nihi9119nihi9119
提出日時 2017-05-30 18:44:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 1,901 bytes
コンパイル時間 3,345 ms
コンパイル使用メモリ 77,868 KB
実行使用メモリ 53,464 KB
最終ジャッジ日時 2023-10-21 18:05:06
合計ジャッジ時間 5,934 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
53,448 KB
testcase_01 AC 55 ms
52,384 KB
testcase_02 AC 56 ms
53,464 KB
testcase_03 AC 55 ms
52,416 KB
testcase_04 AC 56 ms
53,448 KB
testcase_05 AC 55 ms
53,448 KB
testcase_06 AC 56 ms
53,452 KB
testcase_07 AC 56 ms
53,444 KB
testcase_08 AC 55 ms
53,440 KB
testcase_09 AC 56 ms
53,448 KB
testcase_10 AC 56 ms
52,416 KB
testcase_11 AC 55 ms
51,576 KB
testcase_12 AC 55 ms
53,440 KB
testcase_13 AC 56 ms
53,448 KB
testcase_14 AC 56 ms
52,404 KB
testcase_15 AC 54 ms
53,452 KB
testcase_16 AC 54 ms
53,440 KB
testcase_17 AC 55 ms
53,444 KB
testcase_18 AC 54 ms
53,444 KB
testcase_19 AC 55 ms
53,448 KB
testcase_20 AC 54 ms
53,440 KB
testcase_21 AC 56 ms
53,452 KB
testcase_22 AC 55 ms
53,448 KB
testcase_23 AC 54 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test_5;

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

/**
 * コピーに時間がかかるので、しばらくして確認すると
 * 「K%完了しました。あとS分かかります。」
 * と表示されていました。
 *
 * 全体の処理時間(分)を計算してあげてください。
 * 答えは、小数部分の切り捨てをし、整数部分のみを答えてください。
 */

public class Question_08_0530 {

	static final int RATIO_MIN = 1;
	static final int RATIO_MAX = 99;
	static final int MINUTE_MIN = 1;
	static final int MINUTE_MAX = 1000000;

	public static void main(String[] args) {

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

		try {
			int raito = Integer.parseInt(br.readLine());
			int minute = Integer.parseInt(br.readLine());
			int fullTime;

			if (NumJudg(raito, RATIO_MIN, RATIO_MAX) && NumJudg(minute, MINUTE_MIN, MINUTE_MAX)) {
				fullTime = (int) (minute / ((100 - raito) * 0.01));
				System.out.println(fullTime);
			} else {
				System.out.println("数値が有効範囲外です");
			}

		} 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 num 判定する数字
	 * @param max 最大値
	 * @param min 最小値
	 * @return 範囲内ならtrue,範囲外ならfalseを返す
	 */
	private static boolean NumJudg(int num, int min, int max) {
		Boolean result = false;
		if (min <= num && num <= max) {
			result = true;
		}
		return result;
	}

}
0