結果

問題 No.1659 Product of Divisors
ユーザー convexineqconvexineq
提出日時 2021-08-28 21:03:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 75,448 KB
最終ジャッジ日時 2023-08-14 03:18:51
合計ジャッジ時間 3,584 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,440 KB
testcase_01 AC 74 ms
75,420 KB
testcase_02 AC 70 ms
71,172 KB
testcase_03 AC 71 ms
71,512 KB
testcase_04 AC 73 ms
71,520 KB
testcase_05 AC 71 ms
71,248 KB
testcase_06 AC 71 ms
71,336 KB
testcase_07 AC 73 ms
75,448 KB
testcase_08 AC 73 ms
71,512 KB
testcase_09 AC 70 ms
71,360 KB
testcase_10 AC 78 ms
75,372 KB
testcase_11 AC 71 ms
71,356 KB
testcase_12 AC 70 ms
71,472 KB
testcase_13 AC 71 ms
71,456 KB
testcase_14 AC 72 ms
71,352 KB
testcase_15 AC 73 ms
75,440 KB
testcase_16 AC 73 ms
75,424 KB
testcase_17 AC 71 ms
71,356 KB
testcase_18 AC 73 ms
71,384 KB
testcase_19 AC 71 ms
71,480 KB
testcase_20 AC 75 ms
75,444 KB
testcase_21 AC 74 ms
75,380 KB
testcase_22 AC 80 ms
75,428 KB
testcase_23 AC 72 ms
71,436 KB
testcase_24 AC 76 ms
75,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent])
    if N!= 1: factorization.append([N,1])
    assert N != 0, "zero"
    return factorization

n,k = map(int,input().split())
primes = prime_factorize(n)
ans = 1
MOD = 10**9+7
for _,e in primes:
    r = s = 1
    for i in range(1,e+1):
        r = r*(k+i)%MOD
        s = s*i%MOD
    r *= pow(s,MOD-2,MOD)
    ans = ans*r%MOD
print(ans)
0