結果

問題 No.2896 Monotonic Prime Factors
ユーザー るこーそー
提出日時 2024-09-28 00:51:24
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 668 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 104,320 KB
最終ジャッジ日時 2024-09-28 00:51:36
合計ジャッジ時間 8,302 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
def prime_divisors(x):
  P=[]
  for p in range(2,int(x**0.5)+1):
    while x%p==0:
      P.append(p)
      x//=p
  if x>1:
    P.append(x)
  return P

MOD=998244353
fact=[1]*(10**6+1)
for i in range(10**6):
    fact[i+1]=fact[i]*(i+1)%MOD
ifact=[1]*(10**6+1)
ifact[10**6]=pow(fact[10**6],MOD-2,MOD)
for i in range(10**6,0,-1):
    ifact[i-1]=ifact[i]*i%MOD

def nCr(n,r):
    if n<r or n<0 or r<0:return 0
    return fact[n]*ifact[n-r]*ifact[r]%MOD

q=int(input())
ab=[list(map(int,input().split())) for _ in range(q)]
prime_cnt=0
for a,b in ab:
    prime_cnt+=len(prime_divisors(a))
    
    ans=nCr(prime_cnt-1,b-1)
    print(ans)
0