結果

問題 No.1659 Product of Divisors
ユーザー tassei903tassei903
提出日時 2021-08-27 22:02:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,329 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 58,752 KB
最終ジャッジ日時 2024-05-01 02:36:22
合計ジャッジ時間 2,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,248 KB
testcase_01 AC 45 ms
58,752 KB
testcase_02 WA -
testcase_03 AC 43 ms
53,120 KB
testcase_04 AC 55 ms
58,240 KB
testcase_05 AC 52 ms
58,240 KB
testcase_06 AC 46 ms
58,028 KB
testcase_07 AC 46 ms
58,240 KB
testcase_08 AC 59 ms
58,236 KB
testcase_09 AC 60 ms
58,624 KB
testcase_10 AC 60 ms
58,112 KB
testcase_11 AC 60 ms
58,240 KB
testcase_12 AC 60 ms
58,240 KB
testcase_13 WA -
testcase_14 AC 59 ms
58,496 KB
testcase_15 AC 47 ms
58,624 KB
testcase_16 AC 46 ms
58,368 KB
testcase_17 AC 47 ms
57,984 KB
testcase_18 AC 47 ms
58,624 KB
testcase_19 AC 47 ms
58,624 KB
testcase_20 AC 52 ms
58,624 KB
testcase_21 AC 57 ms
58,112 KB
testcase_22 AC 56 ms
58,368 KB
testcase_23 AC 58 ms
58,368 KB
testcase_24 AC 53 ms
58,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################


p = 10 ** 9 + 7
N = 10 ** 3  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
def cmb(n, r):
    res = 1
    for i in range(r):
        res*=n-i
        res%=p
        res*=inv[i+1]
        res%=p
    return res


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n,k = na()
ans = 1
d = factorization(n)
for i, x in d:
    #print(x,k)
    ans*=cmb(x+k,x)
    ans%=p
print(ans)
0