結果

問題 No.2896 Monotonic Prime Factors
ユーザー poeMoon0416
提出日時 2024-09-20 22:20:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 701 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 82,204 KB
実行使用メモリ 84,164 KB
最終ジャッジ日時 2024-09-20 22:20:45
合計ジャッジ時間 4,165 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

# 試し割り法 O(√N)
def prime_factors(src):
    # cnt: 素因数の数
    cnt = 0
    now = src
    i = 2
    # src = i*j のときjがiより大きいなら既出なので√srcまで確認
    while i*i <= src:
        # 割り切れるなら割れるだけ割る
        while now%i == 0:
            now //= i
            cnt += 1
        i += 1
    # それ以上分解できない残ったものを素因数に加える
    if now > 1:
        cnt += 1
    return cnt

MOD = 998244353

# O(N*√N)
# print(10**5*math.sqrt(10**5))
Q = int(input())
cnt = 0
for _ in range(Q):
    A, B = map(int, input().split())
    cnt += prime_factors(A)
    print(math.comb(cnt-1, B-1)%MOD)
0