結果

問題 No.847 Divisors of Power
ユーザー neko_the_shadow
提出日時 2019-07-14 23:32:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 189,568 KB
最終ジャッジ日時 2024-10-07 02:00:06
合計ジャッジ時間 5,010 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 10 WA * 5 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import math, collections, functools

n, k, m = map(int, input().split())

d = collections.defaultdict(int)
for i in range(2, math.ceil(math.sqrt(n)) + 1):
    while n % i == 0:
        d[i] += 1
        n //= i
if n > 1:
    d[n] += 1

p = list(sorted(d.keys())) # 素数
q = [d[i] * k for i in p]      # 指数

# x: 添え字
# y: 合計
@functools.lru_cache(maxsize=None)
def f(x, y):
    if m <= y:
        return 0

    if x == len(p):
        return 1
    
    t = 0
    for i in range(q[x] + 1):
        t += f(x + 1, y * (p[x] ** i))
    return t

print(f(0, 1))
0