結果

問題 No.1663 Maximum Remainder
ユーザー ks2mks2m
提出日時 2021-09-03 21:28:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 2,360 ms
コンパイル使用メモリ 74,684 KB
実行使用メモリ 41,552 KB
最終ジャッジ日時 2024-05-09 01:48:31
合計ジャッジ時間 5,055 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,196 KB
testcase_01 AC 127 ms
41,180 KB
testcase_02 AC 119 ms
41,460 KB
testcase_03 AC 111 ms
40,100 KB
testcase_04 AC 121 ms
41,552 KB
testcase_05 AC 123 ms
41,136 KB
testcase_06 AC 111 ms
40,300 KB
testcase_07 AC 123 ms
41,492 KB
testcase_08 AC 123 ms
39,944 KB
testcase_09 AC 110 ms
40,584 KB
testcase_10 AC 119 ms
41,156 KB
testcase_11 AC 125 ms
41,392 KB
testcase_12 AC 121 ms
41,336 KB
testcase_13 AC 117 ms
41,208 KB
testcase_14 AC 108 ms
40,300 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