結果
問題 |
No.1659 Product of Divisors
|
ユーザー |
![]() |
提出日時 | 2021-08-29 15:02:02 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 882 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 152,320 KB |
最終ジャッジ日時 | 2024-11-22 05:44:37 |
合計ジャッジ時間 | 20,326 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 TLE * 6 |
ソースコード
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)