結果

問題 No.1659 Product of Divisors
ユーザー dachengzdachengz
提出日時 2022-12-17 14:33:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 57,984 KB
最終ジャッジ日時 2024-04-28 09:14:10
合計ジャッジ時間 2,484 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 KB
testcase_01 AC 45 ms
57,216 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 42 ms
51,840 KB
testcase_04 AC 41 ms
51,712 KB
testcase_05 AC 42 ms
51,840 KB
testcase_06 AC 42 ms
51,584 KB
testcase_07 AC 45 ms
57,216 KB
testcase_08 AC 43 ms
51,840 KB
testcase_09 AC 41 ms
52,224 KB
testcase_10 AC 50 ms
57,728 KB
testcase_11 AC 43 ms
51,712 KB
testcase_12 AC 41 ms
51,712 KB
testcase_13 AC 41 ms
52,096 KB
testcase_14 AC 41 ms
51,584 KB
testcase_15 AC 46 ms
57,984 KB
testcase_16 AC 45 ms
57,600 KB
testcase_17 AC 41 ms
51,712 KB
testcase_18 AC 41 ms
51,840 KB
testcase_19 AC 41 ms
52,224 KB
testcase_20 AC 46 ms
57,216 KB
testcase_21 AC 46 ms
57,344 KB
testcase_22 AC 50 ms
57,728 KB
testcase_23 AC 41 ms
51,712 KB
testcase_24 AC 45 ms
57,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7

N, K = map(int, input().split())
if N == 1:
    print(1)
    exit()
pe = {}
if N % 2 == 0:
    e = 0
    while N % 2 == 0:
        N //= 2
        e += 1
    pe[2] = e
p = 3
while p * p <= N:
    if N % p == 0:
        e = 0
        while N % p == 0:
            N //= p
            e += 1
        pe[p] = e
    p += 2
if N > 1:
    pe[N] = 1

l = max(pe.values())
K %= mod
coef = [1] * (l + 1)
inv = [1] * (l + 1)
for i in range(2, l + 1):
    inv[i] = mod - mod // i * inv[mod % i] % mod
for i in range(1, l + 1):
    coef[i] = coef[i - 1] * (K + i) % mod * inv[i] % mod

ans = 1
for e in pe.values():
    ans = ans * coef[e] % mod
print(ans)
0