結果

問題 No.847 Divisors of Power
ユーザー AT274_AT274_
提出日時 2019-10-16 23:35:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 8,908 KB
最終ジャッジ日時 2023-09-05 11:13:38
合計ジャッジ時間 2,805 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,724 KB
testcase_01 AC 19 ms
8,816 KB
testcase_02 AC 19 ms
8,908 KB
testcase_03 AC 19 ms
8,824 KB
testcase_04 AC 18 ms
8,844 KB
testcase_05 AC 19 ms
8,856 KB
testcase_06 AC 23 ms
8,816 KB
testcase_07 AC 22 ms
8,804 KB
testcase_08 AC 23 ms
8,852 KB
testcase_09 AC 22 ms
8,868 KB
testcase_10 AC 19 ms
8,836 KB
testcase_11 AC 21 ms
8,724 KB
testcase_12 AC 21 ms
8,840 KB
testcase_13 AC 21 ms
8,860 KB
testcase_14 AC 21 ms
8,728 KB
testcase_15 AC 146 ms
8,872 KB
testcase_16 AC 22 ms
8,792 KB
testcase_17 AC 23 ms
8,788 KB
testcase_18 AC 23 ms
8,844 KB
testcase_19 AC 25 ms
8,852 KB
testcase_20 AC 20 ms
8,732 KB
testcase_21 AC 58 ms
8,804 KB
testcase_22 AC 21 ms
8,724 KB
testcase_23 AC 23 ms
8,892 KB
testcase_24 AC 160 ms
8,840 KB
testcase_25 AC 21 ms
8,856 KB
testcase_26 AC 18 ms
8,792 KB
testcase_27 AC 23 ms
8,740 KB
testcase_28 AC 19 ms
8,768 KB
testcase_29 AC 19 ms
8,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
N, K, M = map(int, input().split())

prime_factors = []
for n in range(2, int(N ** 0.5) + 1):
    while N > 1:
        if N % n == 0:
            N //= n
            prime_factors.append(n)
        else:
            break
else:
    if N > 1:
        prime_factors.append(N)


C = Counter(prime_factors)
for c in C.keys():
    C[c] *= K
C = list(C.items())


def dfs(i, now):
    if i == len(C):
        return 1

    ans = 0
    for e in range(C[i][1] + 1):
        to_now = now * (C[i][0] ** e)
        if to_now > M:
            break
        ans += dfs(i + 1, to_now)
    return ans


print(dfs(0, 1))
0