結果

問題 No.847 Divisors of Power
ユーザー stng
提出日時 2022-07-17 16:51:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 972 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-06-29 17:56:52
合計ジャッジ時間 3,063 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,m = map(int,input().split())
import math
import sys
sys.setrecursionlimit(10**7)

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)


def factorization(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

fac = factorization(n)
#fac = fac[1:]
#print(fac)
ans = 0

def dfs(v,ttl):
    global ans
    if v == len(fac):
        ans += 1
        return
    for i in range(31):
        if fac[v][1]*k < i:
            break
        if fac[v][0] == 1 and i >= 1:
            break
        num = pow(fac[v][0],i)
        if ttl*num <= m:
            dfs(v+1,ttl*num)
        else:
            break
#if len(fac) > 0:
dfs(0,1)
print(ans)
0