結果

問題 No.847 Divisors of Power
ユーザー NoneNone
提出日時 2021-03-04 17:46:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 89,664 KB
最終ジャッジ日時 2024-04-15 10:08:33
合計ジャッジ時間 2,928 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
54,064 KB
testcase_01 AC 44 ms
53,992 KB
testcase_02 AC 44 ms
54,312 KB
testcase_03 AC 45 ms
55,036 KB
testcase_04 AC 48 ms
59,800 KB
testcase_05 AC 44 ms
55,256 KB
testcase_06 AC 47 ms
59,624 KB
testcase_07 AC 46 ms
54,528 KB
testcase_08 AC 48 ms
60,388 KB
testcase_09 AC 47 ms
60,988 KB
testcase_10 AC 44 ms
55,304 KB
testcase_11 AC 50 ms
61,432 KB
testcase_12 AC 46 ms
59,352 KB
testcase_13 AC 48 ms
60,396 KB
testcase_14 AC 45 ms
55,152 KB
testcase_15 AC 93 ms
84,864 KB
testcase_16 AC 48 ms
59,936 KB
testcase_17 AC 47 ms
60,656 KB
testcase_18 AC 48 ms
60,280 KB
testcase_19 AC 49 ms
61,296 KB
testcase_20 AC 47 ms
59,692 KB
testcase_21 AC 62 ms
68,748 KB
testcase_22 AC 47 ms
59,624 KB
testcase_23 AC 47 ms
59,148 KB
testcase_24 AC 103 ms
89,664 KB
testcase_25 AC 44 ms
53,864 KB
testcase_26 AC 43 ms
53,544 KB
testcase_27 AC 48 ms
60,032 KB
testcase_28 AC 43 ms
53,852 KB
testcase_29 AC 43 ms
55,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factors(n):
    """ n=20 -> res=[2,2,5] """
    res=[]
    i=2
    while i*i<=n:
        if n%i: i+=1
        else:
            n//=i
            res.append(i)
    if n>1:
        res.append(n)
    return res

from collections import Counter

N,K,M=map(int, input().split())

D=Counter(prime_factors(N))
dp=dict()
dp[1]=1
for d, cnt in D.items():
    dp2=dp.copy()
    p=1
    for k in range(1,K*cnt+1):
        p*=d
        if p>M:break
        for key,val in dp.items():
            if key*p<=M:
                dp2[key*p]=1
    dp=dp2
print(len(dp))
0