結果

問題 No.1663 Maximum Remainder
ユーザー ks2mks2m
提出日時 2021-09-03 21:28:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 4,046 ms
コンパイル使用メモリ 71,148 KB
実行使用メモリ 56,212 KB
最終ジャッジ日時 2023-08-21 19:45:21
合計ジャッジ時間 5,786 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,968 KB
testcase_01 AC 134 ms
55,912 KB
testcase_02 AC 123 ms
55,748 KB
testcase_03 AC 126 ms
55,644 KB
testcase_04 AC 124 ms
55,792 KB
testcase_05 AC 125 ms
56,212 KB
testcase_06 AC 124 ms
55,992 KB
testcase_07 AC 126 ms
55,992 KB
testcase_08 AC 125 ms
55,780 KB
testcase_09 AC 126 ms
56,044 KB
testcase_10 AC 127 ms
55,640 KB
testcase_11 AC 124 ms
56,020 KB
testcase_12 AC 125 ms
55,968 KB
testcase_13 AC 123 ms
55,876 KB
testcase_14 AC 121 ms
55,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		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();
		sc.close();

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