結果

問題 No.847 Divisors of Power
ユーザー DrDrpilot
提出日時 2022-02-11 17:08:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 82,848 KB
最終ジャッジ日時 2024-06-27 11:37:05
合計ジャッジ時間 4,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 4 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,m=map(int,input().split())
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
l=factorization(n)
p=[]
for key,val in l:
    if key<=m:
        p.append([key,val*k])
kouho=[]
for key,val in p:
    tmp=[]
    for i in range(val+1):
        tmp.append(pow(key,i))
    kouho.append(tmp)
from itertools import product
ans=set()
for i in product(*kouho):
    now=1
    for j in i:
        now*=j
    if now<=m:
        ans.add(now)
print(len(ans))
0