結果

問題 No.2452 Incline
ユーザー lloyzlloyz
提出日時 2023-09-01 22:05:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 78,344 KB
最終ジャッジ日時 2023-09-01 22:05:27
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,348 KB
testcase_01 AC 72 ms
71,228 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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 // (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