結果

問題 No.1663 Maximum Remainder
ユーザー みーすけみーすけ
提出日時 2021-10-03 12:23:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 2,541 ms
コンパイル使用メモリ 71,160 KB
実行使用メモリ 56,668 KB
最終ジャッジ日時 2023-09-28 11:36:00
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
55,836 KB
testcase_01 AC 135 ms
55,592 KB
testcase_02 AC 129 ms
55,992 KB
testcase_03 AC 127 ms
56,668 KB
testcase_04 AC 127 ms
55,604 KB
testcase_05 AC 129 ms
55,736 KB
testcase_06 AC 132 ms
55,540 KB
testcase_07 AC 129 ms
55,584 KB
testcase_08 AC 130 ms
55,872 KB
testcase_09 AC 127 ms
55,576 KB
testcase_10 AC 127 ms
56,008 KB
testcase_11 AC 128 ms
55,960 KB
testcase_12 AC 126 ms
56,052 KB
testcase_13 AC 127 ms
55,696 KB
testcase_14 AC 127 ms
55,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int m = sc.nextInt();

        int max = 0;
        for (int i = a; i <= b; i++) {
            for (int j = c; j <= d; j++) {
                int v = (i + j) % m;
                if (v > max)
                    max = v;
            }
        }
        System.out.println(max);
    }
}
0