結果

問題 No.1663 Maximum Remainder
ユーザー donutholedonuthole
提出日時 2021-09-03 21:21:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 1,147 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 82,576 KB
最終ジャッジ日時 2023-08-21 19:20:11
合計ジャッジ時間 4,089 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
82,152 KB
testcase_01 AC 203 ms
82,576 KB
testcase_02 AC 186 ms
81,456 KB
testcase_03 AC 185 ms
81,244 KB
testcase_04 AC 184 ms
81,376 KB
testcase_05 AC 189 ms
82,340 KB
testcase_06 AC 186 ms
81,744 KB
testcase_07 AC 186 ms
81,768 KB
testcase_08 AC 183 ms
81,708 KB
testcase_09 AC 186 ms
81,472 KB
testcase_10 AC 186 ms
81,776 KB
testcase_11 AC 183 ms
81,380 KB
testcase_12 AC 183 ms
81,480 KB
testcase_13 AC 183 ms
81,384 KB
testcase_14 AC 183 ms
81,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# region template
import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import copy


def ni(): return int(sys.stdin.buffer.readline())
def ns(): return map(int, sys.stdin.buffer.readline().split())
def ns1(): return map(lambda x: int(x)-1, sys.stdin.buffer.readline().split())
def na(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))
def nall(): return list(map(int, sys.stdin.buffer.read().split()))
def flush(): return sys.stdout.flush()
def nic(): return int(sys.stdin.readline())
def nsc(): return map(int, sys.stdin.readline().split())
def nac(): return list(map(int, sys.stdin.readline().split()))
def na1c(): return list(map(lambda x: int(x)-1, sys.stdin.readline().split()))
# endregion


# sys.setrecursionlimit(10**7+1)
inf = 10**20
mod = 10**9+7
# mod = 998244353


def main():
    a, b, c, d, m = ns()
    res = 0
    for i in range(a, b+1):
        for j in range(c, d+1):
            tres = (i+j) % m
            res = max(tres, res)
    print(res)


if __name__ == '__main__':
    main()
0