結果

問題 No.1663 Maximum Remainder
ユーザー donutholedonuthole
提出日時 2021-09-03 21:21:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 1,147 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 71,808 KB
最終ジャッジ日時 2024-05-09 01:16:00
合計ジャッジ時間 2,231 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
70,528 KB
testcase_01 AC 87 ms
70,656 KB
testcase_02 AC 74 ms
69,120 KB
testcase_03 AC 70 ms
68,736 KB
testcase_04 AC 68 ms
69,120 KB
testcase_05 AC 74 ms
71,808 KB
testcase_06 AC 72 ms
70,016 KB
testcase_07 AC 71 ms
69,632 KB
testcase_08 AC 70 ms
70,016 KB
testcase_09 AC 72 ms
69,504 KB
testcase_10 AC 71 ms
69,504 KB
testcase_11 AC 69 ms
68,992 KB
testcase_12 AC 69 ms
70,144 KB
testcase_13 AC 69 ms
68,736 KB
testcase_14 AC 68 ms
68,864 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