結果

問題 No.2452 Incline
ユーザー KudeKude
提出日時 2023-09-01 21:33:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 79,156 KB
最終ジャッジ日時 2023-09-01 21:33:47
合計ジャッジ時間 4,036 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,348 KB
testcase_01 AC 71 ms
71,184 KB
testcase_02 AC 71 ms
71,388 KB
testcase_03 WA -
testcase_04 AC 380 ms
78,640 KB
testcase_05 AC 370 ms
78,784 KB
testcase_06 WA -
testcase_07 AC 358 ms
78,484 KB
testcase_08 AC 365 ms
79,156 KB
権限があれば一括ダウンロードができます

ソースコード

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 * (r % mod) + mr * rq + 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