結果

問題 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  
実行時間 249 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 27,004 KB
最終ジャッジ日時 2023-08-15 02:10:22
合計ジャッジ時間 2,736 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,496 KB
testcase_01 AC 18 ms
8,496 KB
testcase_02 AC 19 ms
8,504 KB
testcase_03 AC 19 ms
8,592 KB
testcase_04 AC 19 ms
8,616 KB
testcase_05 AC 19 ms
8,696 KB
testcase_06 AC 19 ms
8,516 KB
testcase_07 AC 19 ms
8,528 KB
testcase_08 AC 19 ms
8,524 KB
testcase_09 AC 19 ms
8,644 KB
testcase_10 AC 19 ms
8,556 KB
testcase_11 AC 20 ms
8,556 KB
testcase_12 AC 19 ms
8,576 KB
testcase_13 AC 20 ms
8,744 KB
testcase_14 AC 19 ms
8,708 KB
testcase_15 AC 224 ms
25,476 KB
testcase_16 AC 19 ms
8,504 KB
testcase_17 AC 19 ms
8,544 KB
testcase_18 AC 20 ms
8,752 KB
testcase_19 AC 24 ms
8,912 KB
testcase_20 AC 20 ms
8,576 KB
testcase_21 AC 78 ms
14,536 KB
testcase_22 AC 19 ms
8,576 KB
testcase_23 AC 20 ms
8,488 KB
testcase_24 AC 249 ms
27,004 KB
testcase_25 AC 19 ms
8,580 KB
testcase_26 AC 19 ms
8,676 KB
testcase_27 AC 21 ms
8,536 KB
testcase_28 AC 19 ms
8,616 KB
testcase_29 AC 19 ms
8,628 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