結果
問題 | 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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
53,924 KB |
testcase_01 | AC | 48 ms
60,404 KB |
testcase_02 | AC | 42 ms
55,000 KB |
testcase_03 | AC | 42 ms
54,852 KB |
testcase_04 | AC | 44 ms
54,668 KB |
testcase_05 | AC | 41 ms
54,480 KB |
testcase_06 | AC | 41 ms
55,012 KB |
testcase_07 | AC | 44 ms
59,752 KB |
testcase_08 | AC | 41 ms
54,864 KB |
testcase_09 | AC | 41 ms
54,700 KB |
testcase_10 | AC | 47 ms
59,612 KB |
testcase_11 | AC | 41 ms
55,436 KB |
testcase_12 | AC | 41 ms
54,608 KB |
testcase_13 | AC | 45 ms
55,540 KB |
testcase_14 | AC | 41 ms
54,208 KB |
testcase_15 | AC | 44 ms
59,736 KB |
testcase_16 | AC | 44 ms
60,420 KB |
testcase_17 | AC | 42 ms
55,124 KB |
testcase_18 | AC | 42 ms
54,700 KB |
testcase_19 | AC | 42 ms
54,536 KB |
testcase_20 | AC | 45 ms
60,252 KB |
testcase_21 | AC | 44 ms
60,152 KB |
testcase_22 | AC | 49 ms
60,464 KB |
testcase_23 | AC | 41 ms
54,188 KB |
testcase_24 | AC | 46 ms
59,552 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)