結果

問題 No.388 階段 (1)
ユーザー nihi9119nihi9119
提出日時 2017-05-08 21:02:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 4,828 ms
コンパイル使用メモリ 72,688 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-10-12 19:08:37
合計ジャッジ時間 5,907 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 122 ms
56,108 KB
testcase_02 AC 122 ms
56,036 KB
testcase_03 AC 123 ms
56,068 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 120 ms
53,704 KB
testcase_08 AC 120 ms
55,740 KB
testcase_09 AC 123 ms
56,296 KB
testcase_10 WA -
testcase_11 AC 123 ms
55,692 KB
testcase_12 AC 123 ms
55,704 KB
testcase_13 AC 125 ms
56,152 KB
testcase_14 AC 122 ms
55,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Question_02_0529 {

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

		//入力値
		int num1 = 0;
		int num2 = 0;


		try {
			num1 = sc.nextInt();
			num2 = sc.nextInt();
		} catch (Exception e){
			System.out.println("エラーで終了します。数字を入力して下さい。");
			System.exit(1);
		} finally {
			sc.close();
		}

		if (num1 < 0 || num1 > 456 || num2 < 1 || num2 > 123){
			System.out.println("制約違反です。 0≤現在居る段数≤456 ,1≤段数≤123");
			System.exit(1);
		}

		//計算結果
		int result = 0;
		if (num1 != 0) {
			result = num1 / num2;
			if (num1 % num2 != 0){
				result += 1;
			}
		}
		System.out.println(result);
	}

}
0