結果

問題 No.1659 Product of Divisors
ユーザー 👑 KazunKazun
提出日時 2021-07-22 01:02:38
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 935 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 75,712 KB
最終ジャッジ日時 2023-08-13 07:09:44
合計ジャッジ時間 4,304 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,132 KB
testcase_01 AC 77 ms
75,428 KB
testcase_02 AC 75 ms
71,272 KB
testcase_03 AC 74 ms
71,460 KB
testcase_04 AC 75 ms
71,116 KB
testcase_05 AC 75 ms
71,448 KB
testcase_06 AC 72 ms
71,164 KB
testcase_07 AC 75 ms
75,420 KB
testcase_08 AC 74 ms
71,424 KB
testcase_09 AC 75 ms
71,300 KB
testcase_10 AC 80 ms
75,392 KB
testcase_11 AC 74 ms
71,272 KB
testcase_12 AC 74 ms
71,424 KB
testcase_13 AC 74 ms
71,436 KB
testcase_14 AC 74 ms
71,196 KB
testcase_15 AC 73 ms
71,164 KB
testcase_16 AC 77 ms
75,660 KB
testcase_17 AC 74 ms
71,204 KB
testcase_18 AC 75 ms
71,288 KB
testcase_19 AC 75 ms
71,328 KB
testcase_20 AC 81 ms
75,364 KB
testcase_21 AC 77 ms
75,608 KB
testcase_22 AC 81 ms
75,396 KB
testcase_23 AC 74 ms
71,424 KB
testcase_24 AC 77 ms
75,712 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