結果
| 問題 |
No.2896 Monotonic Prime Factors
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 22:40:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 808 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 82,212 KB |
| 実行使用メモリ | 84,932 KB |
| 最終ジャッジ日時 | 2024-09-20 22:41:03 |
| 合計ジャッジ時間 | 4,094 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 TLE * 1 -- * 15 |
ソースコード
import math
from collections import defaultdict
# 試し割り法 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))
memo = defaultdict(int)
Q = int(input())
cnt = 0
for _ in range(Q):
A, B = map(int, input().split())
if memo[A] == 0:
memo[A] = prime_factors(A)
cnt += memo[A]
print(math.comb(cnt-1, B-1)%MOD)