結果

問題 No.2452 Incline
ユーザー lloyzlloyz
提出日時 2023-09-01 22:03:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 78,228 KB
最終ジャッジ日時 2023-09-01 22:03:40
合計ジャッジ時間 2,839 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
input = sys.stdin.readline

mod = 998244353
for _ in range(int(input())):
    n, m, l, r = map(int, input().split())
    ans = (r - l + 1) % mod
    ans += (r - l + 1) * ((m - l) // (n - 1) + l // (n - 1)) % mod
    ans %= mod
    if m > 0 and n > 2 and m % (n - 1) == 0:
        ans += (r // (n - 1) - (l - 1) // (n - 1)) % mod
        ans %= mod
    print(ans)
0