結果

問題 No.1659 Product of Divisors
ユーザー 👑 KazunKazun
提出日時 2021-07-22 01:02:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 935 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 58,664 KB
最終ジャッジ日時 2024-05-01 00:56:54
合計ジャッジ時間 2,370 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,528 KB
testcase_01 AC 39 ms
57,648 KB
testcase_02 AC 36 ms
53,436 KB
testcase_03 AC 36 ms
53,212 KB
testcase_04 AC 35 ms
52,468 KB
testcase_05 AC 36 ms
52,792 KB
testcase_06 AC 36 ms
52,288 KB
testcase_07 AC 40 ms
58,368 KB
testcase_08 AC 36 ms
53,196 KB
testcase_09 AC 36 ms
53,188 KB
testcase_10 AC 42 ms
58,664 KB
testcase_11 AC 36 ms
52,384 KB
testcase_12 AC 37 ms
52,116 KB
testcase_13 AC 36 ms
53,288 KB
testcase_14 AC 37 ms
52,200 KB
testcase_15 AC 37 ms
53,156 KB
testcase_16 AC 38 ms
58,100 KB
testcase_17 AC 37 ms
53,252 KB
testcase_18 AC 36 ms
53,324 KB
testcase_19 AC 37 ms
53,432 KB
testcase_20 AC 40 ms
58,368 KB
testcase_21 AC 41 ms
58,392 KB
testcase_22 AC 44 ms
58,172 KB
testcase_23 AC 37 ms
53,696 KB
testcase_24 AC 41 ms
58,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#素因数分解
def Prime_Factorization(N):
    if N<0:
        R=[[-1,1]]
    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=0
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=2+2*Flag
        Flag^=1

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

    return R

def nCr(n,r):
    a=b=1
    while r:
        a*=n; a%=Mod
        b*=r; b%=Mod

        n-=1; r-=1

    return (a*pow(b,Mod-2,Mod))%Mod

def nHr(n,r):
    return nCr(n+r-1,r)

#==================================================
N,K=map(int,input().split())

Mod=10**9+7
X=1
for p,e in Prime_Factorization(N):
    X*=nHr(K+1,e); X%=Mod

print(X)
0