結果

問題 No.847 Divisors of Power
ユーザー kohei2019kohei2019
提出日時 2022-04-27 00:34:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2023-09-10 16:29:29
合計ジャッジ時間 2,223 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,816 KB
testcase_01 AC 17 ms
7,864 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 16 ms
7,824 KB
testcase_04 AC 16 ms
7,924 KB
testcase_05 AC 16 ms
7,808 KB
testcase_06 AC 18 ms
7,816 KB
testcase_07 AC 17 ms
7,868 KB
testcase_08 AC 17 ms
7,876 KB
testcase_09 AC 18 ms
7,932 KB
testcase_10 AC 17 ms
7,740 KB
testcase_11 AC 18 ms
7,812 KB
testcase_12 AC 17 ms
7,736 KB
testcase_13 AC 17 ms
7,784 KB
testcase_14 AC 18 ms
7,864 KB
testcase_15 AC 140 ms
12,748 KB
testcase_16 AC 17 ms
7,780 KB
testcase_17 AC 18 ms
7,924 KB
testcase_18 AC 19 ms
8,472 KB
testcase_19 AC 20 ms
8,524 KB
testcase_20 AC 17 ms
7,820 KB
testcase_21 AC 56 ms
10,048 KB
testcase_22 AC 17 ms
7,868 KB
testcase_23 AC 18 ms
7,828 KB
testcase_24 AC 157 ms
13,756 KB
testcase_25 AC 18 ms
7,932 KB
testcase_26 AC 16 ms
7,876 KB
testcase_27 AC 19 ms
7,812 KB
testcase_28 AC 17 ms
7,868 KB
testcase_29 AC 16 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

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 ind == len(bb):
        ans.append(val)
        return
    a,b = bb[ind]
    for i in range(b+1):
        if val*(a**i) > M:
            break
        func(ind+1, val*(a**i))
func(0,1)
print(len(ans))
0