結果

問題 No.847 Divisors of Power
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-07 18:44:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 776 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 84,844 KB
最終ジャッジ日時 2023-08-25 12:47:41
合計ジャッジ時間 4,054 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,708 KB
testcase_01 AC 59 ms
71,464 KB
testcase_02 AC 59 ms
71,480 KB
testcase_03 AC 60 ms
71,224 KB
testcase_04 AC 60 ms
71,360 KB
testcase_05 AC 63 ms
71,560 KB
testcase_06 AC 62 ms
75,268 KB
testcase_07 AC 63 ms
75,540 KB
testcase_08 AC 62 ms
75,568 KB
testcase_09 AC 63 ms
75,464 KB
testcase_10 AC 61 ms
75,608 KB
testcase_11 AC 62 ms
75,644 KB
testcase_12 AC 61 ms
75,468 KB
testcase_13 AC 63 ms
75,984 KB
testcase_14 AC 63 ms
75,564 KB
testcase_15 AC 133 ms
83,164 KB
testcase_16 AC 60 ms
75,648 KB
testcase_17 AC 60 ms
75,488 KB
testcase_18 AC 70 ms
76,520 KB
testcase_19 AC 85 ms
77,916 KB
testcase_20 AC 61 ms
75,432 KB
testcase_21 AC 125 ms
80,236 KB
testcase_22 AC 60 ms
75,596 KB
testcase_23 AC 60 ms
75,488 KB
testcase_24 AC 134 ms
84,844 KB
testcase_25 AC 63 ms
75,488 KB
testcase_26 AC 60 ms
71,580 KB
testcase_27 AC 62 ms
75,648 KB
testcase_28 AC 59 ms
71,396 KB
testcase_29 AC 61 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if n == 1:
    print(1)
    exit()

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

d = factorize(n)
for k_ in d.keys():
    d[k_] *= k

L = list(d.items())

ans = []

def dfs(x, cnt):
    if cnt == len(d):
        ans.append(x)
        return
    k, v = L[cnt]
    for i in range(0, v+1):
        x *= k**i
        if x > m:
            break
        dfs(x, cnt+1)
        x //= k**i

dfs(1, 0)
print(len(ans))
0