結果

問題 No.1659 Product of Divisors
ユーザー tamatotamato
提出日時 2021-08-27 21:38:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 83,008 KB
実行使用メモリ 59,400 KB
最終ジャッジ日時 2024-05-01 01:56:59
合計ジャッジ時間 1,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,268 KB
testcase_01 AC 33 ms
58,844 KB
testcase_02 AC 33 ms
52,572 KB
testcase_03 AC 35 ms
52,704 KB
testcase_04 AC 33 ms
52,676 KB
testcase_05 AC 32 ms
52,660 KB
testcase_06 AC 36 ms
57,644 KB
testcase_07 AC 35 ms
59,116 KB
testcase_08 AC 34 ms
52,944 KB
testcase_09 AC 33 ms
52,268 KB
testcase_10 AC 47 ms
58,180 KB
testcase_11 AC 36 ms
52,804 KB
testcase_12 AC 35 ms
53,084 KB
testcase_13 AC 33 ms
53,024 KB
testcase_14 AC 33 ms
52,704 KB
testcase_15 AC 36 ms
58,036 KB
testcase_16 AC 36 ms
59,300 KB
testcase_17 AC 35 ms
58,188 KB
testcase_18 AC 36 ms
58,108 KB
testcase_19 AC 36 ms
57,724 KB
testcase_20 AC 42 ms
57,596 KB
testcase_21 AC 45 ms
59,400 KB
testcase_22 AC 45 ms
58,392 KB
testcase_23 AC 36 ms
58,320 KB
testcase_24 AC 44 ms
58,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

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

    upper = [1] * 51
    lower = [1] * 51
    for i in range(50):
        upper[i+1] = (upper[i] * (K + i + 1))%mod
        lower[i+1] = (lower[i] * (i + 1))%mod

    P = PrimeDecomposition(N)
    ans = 1
    for p in P:
        x = P[p]
        ans = (ans * upper[x] * pow(lower[x], mod-2, mod))%mod
    print(ans)


if __name__ == '__main__':
    main()
0