結果

問題 No.2452 Incline
ユーザー fiblonariafiblonaria
提出日時 2023-09-05 14:37:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 839 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 79,800 KB
最終ジャッジ日時 2023-09-05 14:37:07
合計ジャッジ時間 4,973 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def solve_(N, M, b):
	if b == -1:
		return 0
	ans = M // (N - 1) * (b + 1)
	ans += (M % (N - 1) + 1) * (b // (N - 1))
	ans += max(M % (N - 1) + 1, b % (N - 1))
	return ans

def solve(N, M, L, R):
	return solve_(N, M, R) - solve_(N, M, L - 1)

T = int(input())
for i in range(T):
	N, M, L, R = map(int, input().split())
	print(solve(N, M, L, R) % 998244353)
0