結果
| 問題 | 
                            No.1659 Product of Divisors
                             | 
                    
| コンテスト | |
| ユーザー | 
                             H20
                         | 
                    
| 提出日時 | 2021-08-27 23:11:11 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 49 ms / 2,000 ms | 
| コード長 | 2,387 bytes | 
| コンパイル時間 | 260 ms | 
| コンパイル使用メモリ | 82,236 KB | 
| 実行使用メモリ | 60,464 KB | 
| 最終ジャッジ日時 | 2024-11-21 05:04:14 | 
| 合計ジャッジ時間 | 2,143 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 23 | 
ソースコード
import collections
# ModInt 参考は以下のサイト
# https://qiita.com/wotsushi/items/c936838df992b706084c
MOD = 10**9+7
class ModInt:
    def __init__(self, x):
        self.x = x % MOD
    def __str__(self):
        return str(self.x)
    __repr__ = __str__
    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )
    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )
    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )
    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )
    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )
    __radd__ = __add__
    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )
    __rmul__ = __mul__
    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )
    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )
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
N,K = map(int, input().split())
mod = 10**9+7
P = prime_factorize(N)
C = collections.Counter(P)
L = []
for v in C.values():
    L.append(v)
ans = ModInt(1)
for l in L:
    temp = ModInt(1)
    for i in range(1,l+1):
        temp = temp*(K+l+1-i)
        temp = temp/i
    ans = ans*temp
print(ans)
            
            
            
        
            
H20