結果

問題 No.847 Divisors of Power
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-09 23:56:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,352 KB
最終ジャッジ日時 2024-05-02 14:37:04
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 26 ms
10,624 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 27 ms
10,752 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 27 ms
10,880 KB
testcase_12 AC 26 ms
10,752 KB
testcase_13 AC 27 ms
10,880 KB
testcase_14 AC 27 ms
10,624 KB
testcase_15 AC 234 ms
27,844 KB
testcase_16 AC 28 ms
10,752 KB
testcase_17 AC 27 ms
10,752 KB
testcase_18 AC 27 ms
10,880 KB
testcase_19 AC 31 ms
11,008 KB
testcase_20 AC 28 ms
10,752 KB
testcase_21 AC 85 ms
16,768 KB
testcase_22 AC 29 ms
10,752 KB
testcase_23 AC 29 ms
10,752 KB
testcase_24 AC 253 ms
29,352 KB
testcase_25 AC 26 ms
10,752 KB
testcase_26 AC 25 ms
10,880 KB
testcase_27 AC 29 ms
10,752 KB
testcase_28 AC 27 ms
10,752 KB
testcase_29 AC 26 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
        
    if n == 1:
        a.append(n)
        
    return a

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

prime_clc = collections.Counter(prime_factorize(n))

for key in prime_clc:
    prime_clc[key] *= k
    
l_list = list(prime_clc.keys())
len_l_list = len(l_list)
ans_list = []

def dfs(dim1, now):
    if dim1 == len_l_list:
        return 
    
    for i in range(prime_clc[l_list[dim1]] + 1):
        if now * (l_list[dim1] ** i) <= m:
            ans_list.append(now * (l_list[dim1] ** i))
            dfs(dim1 + 1, now * (l_list[dim1] ** i))
        else:
            break
            
dfs(0, 1)

res = len(set(ans_list))
print(res)
0