結果

問題 No.2141 Enumeratest
ユーザー shobonvipshobonvip
提出日時 2022-12-02 21:32:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 75,908 KB
最終ジャッジ日時 2024-04-18 05:16:42
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
74,860 KB
testcase_01 AC 61 ms
74,340 KB
testcase_02 AC 62 ms
74,664 KB
testcase_03 AC 63 ms
74,376 KB
testcase_04 AC 62 ms
74,808 KB
testcase_05 AC 62 ms
75,648 KB
testcase_06 AC 61 ms
75,116 KB
testcase_07 AC 62 ms
74,936 KB
testcase_08 AC 62 ms
74,116 KB
testcase_09 AC 62 ms
74,168 KB
testcase_10 AC 61 ms
74,256 KB
testcase_11 AC 62 ms
74,324 KB
testcase_12 AC 67 ms
75,908 KB
testcase_13 AC 62 ms
74,732 KB
testcase_14 AC 62 ms
75,736 KB
testcase_15 AC 61 ms
75,196 KB
testcase_16 AC 64 ms
74,312 KB
testcase_17 AC 63 ms
75,292 KB
testcase_18 AC 63 ms
74,764 KB
testcase_19 AC 63 ms
74,400 KB
testcase_20 AC 63 ms
75,308 KB
testcase_21 AC 61 ms
75,392 KB
testcase_22 AC 62 ms
74,684 KB
testcase_23 AC 62 ms
74,880 KB
testcase_24 AC 63 ms
74,248 KB
testcase_25 AC 62 ms
74,192 KB
testcase_26 AC 61 ms
75,156 KB
testcase_27 AC 62 ms
74,280 KB
testcase_28 AC 63 ms
74,524 KB
testcase_29 AC 63 ms
74,824 KB
testcase_30 AC 61 ms
74,476 KB
testcase_31 AC 62 ms
74,156 KB
testcase_32 AC 65 ms
74,320 KB
testcase_33 AC 61 ms
75,312 KB
testcase_34 AC 61 ms
74,276 KB
testcase_35 AC 61 ms
74,432 KB
testcase_36 AC 62 ms
74,248 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,m = map(int,input().split())
f = factinv[m // n]
g = factinv[m // n + 1]
l = m % n
print(pow(f, n - l, mod) * pow(g, l, mod) * fact[m] % mod)
0