結果

問題 No.847 Divisors of Power
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-07-14 23:32:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 180,224 KB
最終ジャッジ日時 2024-04-16 09:33:28
合計ジャッジ時間 5,283 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
60,288 KB
testcase_01 AC 44 ms
55,040 KB
testcase_02 AC 45 ms
56,320 KB
testcase_03 AC 73 ms
77,712 KB
testcase_04 AC 218 ms
98,744 KB
testcase_05 WA -
testcase_06 AC 46 ms
61,184 KB
testcase_07 AC 48 ms
60,928 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 47 ms
62,592 KB
testcase_13 AC 100 ms
77,612 KB
testcase_14 AC 90 ms
77,952 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

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