結果

問題 No.1663 Maximum Remainder
ユーザー kimiyukikimiyuki
提出日時 2021-09-03 22:29:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 9,848 KB
最終ジャッジ日時 2023-08-21 23:10:49
合計ジャッジ時間 1,843 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,644 KB
testcase_01 AC 31 ms
9,840 KB
testcase_02 AC 32 ms
9,720 KB
testcase_03 AC 31 ms
9,728 KB
testcase_04 AC 30 ms
9,648 KB
testcase_05 AC 31 ms
9,644 KB
testcase_06 AC 31 ms
9,656 KB
testcase_07 AC 31 ms
9,664 KB
testcase_08 AC 32 ms
9,680 KB
testcase_09 AC 31 ms
9,680 KB
testcase_10 AC 31 ms
9,660 KB
testcase_11 AC 31 ms
9,848 KB
testcase_12 AC 32 ms
9,700 KB
testcase_13 AC 31 ms
9,652 KB
testcase_14 AC 31 ms
9,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from typing import *


def solve(a: int, b: int, c: int, d: int, m: int) -> int:
    l = a + c
    r = b + d
    r -= (l - l % m)
    l %= m
    if m - 1 <= r:
        return m - 1
    else:
        return r


# generated by oj-template v4.8.0 (https://github.com/online-judge-tools/template-generator)
def main():
    a, b, c, d, m = map(int, input().split())
    a1 = solve(a, b, c, d, m)
    print(a1)


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