結果

問題 No.847 Divisors of Power
ユーザー kohei2019
提出日時 2022-04-27 00:31:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 792 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 90,496 KB
最終ジャッジ日時 2024-06-28 07:33:23
合計ジャッジ時間 4,656 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 15 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(N):#素因数分解√N
    arr = []
    temp = N
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([N, 1])
    return arr #[素因数、個数]
N,K,M = map(int,input().split())
if N == 1:
    print(1)
    exit()
pp = factorization(N)
bb = []
for i in range(len(pp)):
    a,b = pp[i]
    b = min(b*K,30)
    bb.append((a,b))
ans = []
def func(ind,val):
    if val > M:
        return
    if ind == len(bb):
        ans.append(val)
        return
    a,b = bb[ind]
    for i in range(b+1):
        func(ind+1, val*(a**i))
func(0,1)
print(len(ans))
0