結果

問題 No.847 Divisors of Power
ユーザー O2MTO2MT
提出日時 2020-12-08 11:13:11
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 18,820 KB
最終ジャッジ日時 2023-10-17 17:02:26
合計ジャッジ時間 2,862 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,316 KB
testcase_01 AC 29 ms
10,260 KB
testcase_02 AC 29 ms
10,320 KB
testcase_03 AC 29 ms
10,316 KB
testcase_04 AC 29 ms
10,360 KB
testcase_05 AC 29 ms
10,320 KB
testcase_06 AC 31 ms
10,316 KB
testcase_07 AC 31 ms
10,316 KB
testcase_08 AC 32 ms
10,260 KB
testcase_09 AC 30 ms
10,316 KB
testcase_10 AC 30 ms
10,320 KB
testcase_11 AC 32 ms
10,360 KB
testcase_12 AC 30 ms
10,316 KB
testcase_13 AC 31 ms
10,360 KB
testcase_14 AC 30 ms
10,268 KB
testcase_15 AC 216 ms
18,820 KB
testcase_16 AC 31 ms
10,316 KB
testcase_17 AC 31 ms
10,260 KB
testcase_18 AC 31 ms
10,364 KB
testcase_19 AC 34 ms
10,480 KB
testcase_20 AC 30 ms
10,260 KB
testcase_21 AC 82 ms
13,460 KB
testcase_22 AC 29 ms
10,260 KB
testcase_23 AC 30 ms
10,316 KB
testcase_24 AC 238 ms
18,764 KB
testcase_25 AC 31 ms
10,320 KB
testcase_26 AC 28 ms
10,260 KB
testcase_27 AC 30 ms
10,316 KB
testcase_28 AC 28 ms
10,316 KB
testcase_29 AC 28 ms
10,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def addNum(n,cnt):
    if cnt == len(l):
        ans.add(n)
        return
    for i in range(l[cnt][1]*K+1):
        num = n*l[cnt][0]**i
        if num > M:
            break
        ans.add(num)
        addNum(num,cnt+1)


N,K,M = map(int,input().split())
l = factorization(N)
ans = set()
addNum(1,0)
print(len(ans))
0