結果

問題 No.847 Divisors of Power
ユーザー convexineqconvexineq
提出日時 2021-02-18 21:45:44
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 77,232 KB
最終ジャッジ日時 2023-10-13 05:26:26
合計ジャッジ時間 4,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,448 KB
testcase_01 AC 70 ms
71,072 KB
testcase_02 AC 69 ms
71,616 KB
testcase_03 AC 72 ms
71,340 KB
testcase_04 AC 74 ms
71,408 KB
testcase_05 AC 69 ms
71,476 KB
testcase_06 AC 75 ms
75,264 KB
testcase_07 AC 70 ms
71,396 KB
testcase_08 AC 76 ms
75,536 KB
testcase_09 AC 74 ms
71,304 KB
testcase_10 AC 72 ms
71,160 KB
testcase_11 AC 71 ms
71,152 KB
testcase_12 AC 71 ms
71,248 KB
testcase_13 AC 76 ms
75,356 KB
testcase_14 AC 75 ms
71,396 KB
testcase_15 AC 129 ms
77,232 KB
testcase_16 AC 71 ms
75,548 KB
testcase_17 AC 68 ms
71,144 KB
testcase_18 AC 74 ms
76,128 KB
testcase_19 AC 86 ms
76,072 KB
testcase_20 AC 70 ms
75,628 KB
testcase_21 AC 106 ms
77,032 KB
testcase_22 AC 73 ms
75,492 KB
testcase_23 AC 70 ms
75,364 KB
testcase_24 AC 128 ms
77,204 KB
testcase_25 AC 68 ms
71,476 KB
testcase_26 AC 69 ms
71,308 KB
testcase_27 AC 71 ms
75,656 KB
testcase_28 AC 69 ms
71,116 KB
testcase_29 AC 69 ms
71,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent*k]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent*k])
    if N!= 1: factorization.append([N,k])
    assert N != 0, "zero"
    return factorization

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

L = len(fac)
ans = 0
def dfs(x,i):
    global ans
    if i >= L:
        ans += 1
        return
    p,c = fac[i]
    while x <= m and c >= 0:
        dfs(x,i+1)
        x *= p
        c -= 1

dfs(1,0)
print(ans)
0