結果

問題 No.847 Divisors of Power
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-07-14 23:36:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 559 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 179,016 KB
最終ジャッジ日時 2024-04-16 09:34:14
合計ジャッジ時間 4,113 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
55,296 KB
testcase_01 AC 48 ms
55,680 KB
testcase_02 AC 49 ms
56,064 KB
testcase_03 AC 48 ms
54,784 KB
testcase_04 AC 53 ms
56,704 KB
testcase_05 AC 51 ms
55,552 KB
testcase_06 AC 53 ms
61,440 KB
testcase_07 AC 55 ms
61,184 KB
testcase_08 AC 52 ms
60,544 KB
testcase_09 AC 53 ms
61,184 KB
testcase_10 AC 54 ms
62,208 KB
testcase_11 AC 58 ms
64,640 KB
testcase_12 AC 53 ms
61,312 KB
testcase_13 AC 59 ms
65,152 KB
testcase_14 AC 55 ms
62,976 KB
testcase_15 AC 498 ms
163,816 KB
testcase_16 AC 52 ms
60,416 KB
testcase_17 AC 53 ms
61,312 KB
testcase_18 AC 65 ms
67,328 KB
testcase_19 AC 101 ms
78,080 KB
testcase_20 AC 52 ms
60,696 KB
testcase_21 AC 251 ms
99,496 KB
testcase_22 AC 54 ms
60,800 KB
testcase_23 AC 52 ms
60,800 KB
testcase_24 AC 559 ms
179,016 KB
testcase_25 AC 55 ms
61,600 KB
testcase_26 AC 49 ms
55,424 KB
testcase_27 AC 53 ms
60,928 KB
testcase_28 AC 49 ms
55,424 KB
testcase_29 AC 50 ms
55,040 KB
権限があれば一括ダウンロードができます

ソースコード

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 x == len(p):
        return 1
    
    t = 0
    z = 1
    for i in range(q[x] + 1):
        z = y * (p[x] ** i)
        if m < z:
            break
        t += f(x + 1, z)
    return t

print(f(0, 1))
0