結果

問題 No.847 Divisors of Power
ユーザー 👑 KazunKazun
提出日時 2021-03-09 13:56:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,840 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-04-19 11:34:45
合計ジャッジ時間 2,277 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,584 KB
testcase_01 AC 36 ms
51,712 KB
testcase_02 AC 35 ms
52,608 KB
testcase_03 AC 31 ms
52,352 KB
testcase_04 AC 31 ms
52,736 KB
testcase_05 AC 32 ms
52,352 KB
testcase_06 AC 36 ms
58,240 KB
testcase_07 AC 32 ms
51,584 KB
testcase_08 AC 35 ms
57,856 KB
testcase_09 AC 32 ms
51,840 KB
testcase_10 AC 32 ms
52,352 KB
testcase_11 AC 32 ms
52,608 KB
testcase_12 AC 32 ms
51,712 KB
testcase_13 AC 35 ms
58,112 KB
testcase_14 AC 32 ms
52,608 KB
testcase_15 AC 93 ms
76,160 KB
testcase_16 AC 33 ms
52,480 KB
testcase_17 AC 33 ms
52,608 KB
testcase_18 AC 42 ms
61,056 KB
testcase_19 AC 56 ms
69,248 KB
testcase_20 AC 37 ms
58,240 KB
testcase_21 AC 73 ms
76,416 KB
testcase_22 AC 36 ms
58,112 KB
testcase_23 AC 36 ms
57,856 KB
testcase_24 AC 96 ms
76,264 KB
testcase_25 AC 32 ms
52,224 KB
testcase_26 AC 32 ms
51,584 KB
testcase_27 AC 34 ms
58,112 KB
testcase_28 AC 33 ms
52,096 KB
testcase_29 AC 31 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#素因数分解
def Prime_Factorization(N):
    if N<0:
        R=[]
    else:
        R=[]

    N=abs(N)

    if N&1==0:
        C=0
        while N&1==0:
            N>>=1
            C+=1
        R.append([2,C])

    if N%3==0:
        C=0
        while N%3==0:
            N//=3
            C+=1
        R.append([3,C])

    k=5
    Flag=1
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=2 if Flag else 4
        Flag^=1

    if N!=1:
        R.append([N,1])
    if not R:
        R.append([N,1])

    return R
#================================================
def f(i,prod):
    if i==P_len:
        return 1

    X=0
    q=prod
    p,e=P[i]
    for k in range(e+1):
        if q>M:
            break
        X+=f(i+1,q)
        q*=p
    return X
#================================================
N,K,M=map(int,input().split())

P=[[p,K*e] for p,e in Prime_Factorization(N) if p>1]
P_len=len(P)
print(f(0,1))
0