結果

問題 No.2452 Incline
ユーザー KudeKude
提出日時 2023-09-01 21:37:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 79,044 KB
最終ジャッジ日時 2023-09-01 21:37:59
合計ジャッジ時間 3,945 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 71 ms
71,564 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
def f(r, m, n):
    mq, mr = divmod(m, n)
    rq, rr = divmod(r, n)
    mq %= mod
    mr %= mod
    rq %= mod
    rr %= mod
    return (mq * rq + mr * rq + mq * rr + min(mr, rr)) % mod


for _ in range(int(input())):
    n, m, l, r = map(int, input().split())
    print((f(r + 1, m + 1, n - 1) - f(l, m + 1, n - 1)) % mod)
0