結果

問題 No.2896 Monotonic Prime Factors
ユーザー ねしんねしん
提出日時 2024-09-20 22:12:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 501 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 240,256 KB
最終ジャッジ日時 2024-09-20 22:13:22
合計ジャッジ時間 36,397 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,451 ms
238,080 KB
testcase_01 AC 1,422 ms
238,080 KB
testcase_02 AC 1,404 ms
238,080 KB
testcase_03 AC 1,414 ms
237,696 KB
testcase_04 TLE -
testcase_05 RE -
testcase_06 AC 1,815 ms
238,080 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 RE -
testcase_10 AC 1,746 ms
238,080 KB
testcase_11 AC 1,563 ms
237,952 KB
testcase_12 AC 1,540 ms
238,208 KB
testcase_13 AC 1,744 ms
237,952 KB
testcase_14 AC 1,821 ms
238,080 KB
testcase_15 AC 1,486 ms
238,080 KB
testcase_16 AC 1,609 ms
237,952 KB
testcase_17 AC 1,517 ms
237,952 KB
testcase_18 AC 1,943 ms
238,080 KB
testcase_19 AC 1,518 ms
237,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
fact=[1,1]
invfact=[1,1]
MOD=998244353
for i in range(2,13*10**5+1):
	fact.append((fact[-1]*i)%MOD)
	invfact.append((invfact[-1]*pow(i,MOD-2,MOD))%MOD)
def factrize(A):
	c=0
	M=A
	for i in range(2,int(A**0.5)+3):
		if  M<i:
			break
		while M%i==0:
			M=M//i
			c+=1
	if M!=1:
		c+=1
	return c
def C(n,r):
	return (fact[n]*invfact[r]*invfact[n-r])%MOD
cnt=0
for i in range(Q):
	a,b=list(map(int,input().split()))
	cnt+=factrize(a)
	if cnt<b:
		print(0)
		continue
	print(C(cnt-1,cnt-b))
0