結果

問題 No.847 Divisors of Power
ユーザー kohei2019
提出日時 2022-04-27 00:32:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 792 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-06-28 07:33:30
合計ジャッジ時間 6,731 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

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