結果
問題 | No.1659 Product of Divisors |
ユーザー | 👑 H20 |
提出日時 | 2021-08-27 23:11:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 2,387 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 87,048 KB |
実行使用メモリ | 76,820 KB |
最終ジャッジ日時 | 2023-08-13 10:43:39 |
合計ジャッジ時間 | 3,878 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 93 ms
71,728 KB |
testcase_01 | AC | 99 ms
76,332 KB |
testcase_02 | AC | 99 ms
71,768 KB |
testcase_03 | AC | 94 ms
71,328 KB |
testcase_04 | AC | 94 ms
71,500 KB |
testcase_05 | AC | 94 ms
71,404 KB |
testcase_06 | AC | 96 ms
71,584 KB |
testcase_07 | AC | 97 ms
76,548 KB |
testcase_08 | AC | 93 ms
71,584 KB |
testcase_09 | AC | 92 ms
71,628 KB |
testcase_10 | AC | 105 ms
76,460 KB |
testcase_11 | AC | 92 ms
71,528 KB |
testcase_12 | AC | 95 ms
71,584 KB |
testcase_13 | AC | 92 ms
71,668 KB |
testcase_14 | AC | 93 ms
71,524 KB |
testcase_15 | AC | 98 ms
76,820 KB |
testcase_16 | AC | 98 ms
76,528 KB |
testcase_17 | AC | 92 ms
71,536 KB |
testcase_18 | AC | 94 ms
71,396 KB |
testcase_19 | AC | 93 ms
71,296 KB |
testcase_20 | AC | 100 ms
76,420 KB |
testcase_21 | AC | 98 ms
76,268 KB |
testcase_22 | AC | 107 ms
76,360 KB |
testcase_23 | AC | 93 ms
71,404 KB |
testcase_24 | AC | 99 ms
76,660 KB |
ソースコード
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)