結果
| 問題 |
No.847 Divisors of Power
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-05 23:11:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 746 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 77,696 KB |
| 最終ジャッジ日時 | 2024-10-06 23:02:38 |
| 合計ジャッジ時間 | 5,500 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 8 TLE * 1 -- * 17 |
ソースコード
import collections
N,K,M = [int(x) for x in input().split()]
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
ps = sorted([1,*prime_factors(N)])
maxcount = {k:v*K for k,v in collections.Counter(ps).items()}
solve = set([1])
def minimum_next(solve):
m=2**64
for s in solve:
for p in ps:
if collections.Counter(prime_factors(p*s))[p]>maxcount[p]:
continue
if p*s not in solve:
m=min(m,p*s)
solve.add(m)
while(max(solve)<=M):
minimum_next(solve)
print(len([x for x in solve if x<=M]))