結果

問題 No.1659 Product of Divisors
ユーザー ntudantuda
提出日時 2021-08-29 15:02:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 882 bytes
コンパイル時間 1,636 ms
コンパイル使用メモリ 86,680 KB
実行使用メモリ 91,060 KB
最終ジャッジ日時 2023-08-14 09:56:59
合計ジャッジ時間 4,902 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,604 KB
testcase_01 AC 76 ms
75,796 KB
testcase_02 AC 71 ms
71,448 KB
testcase_03 AC 70 ms
71,312 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools, math, sys
mod = 10 ** 9 + 7
N,K = map(int,input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

P = prime_factorize(N)
NP = len(P)
P = P + [1] * NP
# nCk (mod MOD) を求める
def comb(n, k):
    tmp = 1
    for i in range(k):
        tmp = (tmp * (n - i) * pow(i+1, mod-2, mod)) % mod
    return tmp

Y = set(itertools.combinations(P,NP))
ans = 0
for y in Y:
    dic = {}
    for i in y:
        if i > 1:
            if i in dic:
                dic[i] += 1
            else:
                dic[i] = 1
    tmp = 1
    for k,v in dic.items():
        tmp = tmp * comb(K+v-1,v) % mod
    ans += tmp
    ans %= mod
print(ans)
0