結果

問題 No.2452 Incline
ユーザー KudeKude
提出日時 2023-09-01 21:39:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 465 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 79,324 KB
最終ジャッジ日時 2023-09-01 21:39:24
合計ジャッジ時間 4,348 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,456 KB
testcase_01 AC 70 ms
71,320 KB
testcase_02 AC 69 ms
71,524 KB
testcase_03 AC 447 ms
78,784 KB
testcase_04 AC 455 ms
79,116 KB
testcase_05 AC 465 ms
79,324 KB
testcase_06 AC 376 ms
78,348 KB
testcase_07 AC 387 ms
78,596 KB
testcase_08 AC 364 ms
78,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
def f(r, m, n):
    mq, mr = divmod(m, n)
    rq, rr = divmod(r, n)
    return (mq * rq * n + 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