結果

問題 No.847 Divisors of Power
ユーザー kohei2019kohei2019
提出日時 2022-04-27 00:32:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,918 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 13,848 KB
最終ジャッジ日時 2023-09-10 16:29:26
合計ジャッジ時間 5,792 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,792 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 15 ms
7,816 KB
testcase_03 AC 16 ms
7,700 KB
testcase_04 AC 17 ms
7,704 KB
testcase_05 AC 16 ms
7,788 KB
testcase_06 AC 17 ms
7,940 KB
testcase_07 AC 17 ms
7,908 KB
testcase_08 AC 17 ms
7,820 KB
testcase_09 AC 17 ms
7,932 KB
testcase_10 AC 16 ms
7,768 KB
testcase_11 AC 18 ms
7,904 KB
testcase_12 AC 17 ms
7,700 KB
testcase_13 AC 17 ms
7,768 KB
testcase_14 AC 17 ms
7,968 KB
testcase_15 AC 1,797 ms
12,952 KB
testcase_16 AC 18 ms
7,872 KB
testcase_17 AC 19 ms
7,788 KB
testcase_18 AC 30 ms
7,772 KB
testcase_19 AC 66 ms
8,388 KB
testcase_20 AC 16 ms
7,820 KB
testcase_21 AC 162 ms
9,920 KB
testcase_22 AC 17 ms
7,816 KB
testcase_23 AC 18 ms
7,788 KB
testcase_24 AC 1,918 ms
13,848 KB
testcase_25 AC 18 ms
7,948 KB
testcase_26 AC 16 ms
7,736 KB
testcase_27 AC 18 ms
7,880 KB
testcase_28 AC 16 ms
7,816 KB
testcase_29 AC 15 ms
8,128 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 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