結果

問題 No.2199 lower_bound and upper_bound
ユーザー shobonvipshobonvip
提出日時 2023-01-22 03:36:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 1,562 ms
コンパイル使用メモリ 86,732 KB
実行使用メモリ 93,480 KB
最終ジャッジ日時 2023-09-06 13:49:04
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
91,468 KB
testcase_01 AC 95 ms
91,624 KB
testcase_02 AC 103 ms
91,836 KB
testcase_03 AC 95 ms
91,644 KB
testcase_04 AC 95 ms
91,484 KB
testcase_05 AC 95 ms
91,424 KB
testcase_06 AC 95 ms
91,568 KB
testcase_07 AC 89 ms
91,568 KB
testcase_08 AC 86 ms
91,592 KB
testcase_09 AC 82 ms
91,636 KB
testcase_10 AC 95 ms
91,728 KB
testcase_11 AC 83 ms
91,676 KB
testcase_12 AC 84 ms
91,500 KB
testcase_13 AC 91 ms
93,480 KB
testcase_14 AC 85 ms
91,588 KB
testcase_15 AC 84 ms
91,648 KB
testcase_16 AC 88 ms
92,156 KB
testcase_17 AC 94 ms
93,404 KB
testcase_18 AC 88 ms
92,560 KB
testcase_19 AC 89 ms
93,456 KB
testcase_20 AC 88 ms
92,512 KB
testcase_21 AC 89 ms
93,216 KB
testcase_22 AC 90 ms
91,992 KB
testcase_23 AC 90 ms
93,112 KB
testcase_24 AC 90 ms
91,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
N = 10**6 + 5
fact = [1]*(N+1)
factinv = [1]*(N+1)

for i in range(2, N+1):
	fact[i] = fact[i-1] * i % mod

factinv[-1] = pow(fact[-1], mod-2, mod)
for i in range(N-1, 1, -1):
	factinv[i] = factinv[i+1] * (i+1) % mod

def cmb(a, b):
	if (a < b) or (b < 0):
		return 0
	return fact[a] * factinv[b] % mod * factinv[a-b] % mod


n,l,u = map(int,input().split())

ans = 0
for i in range(l + n - 1, u + n + 1):
	ans += cmb(i + n, n - 1) - cmb(i + n, i - u - 1)
	ans %= mod
print(ans)
0