結果
| 問題 |
No.847 Divisors of Power
|
| コンテスト | |
| ユーザー |
toyuzuko
|
| 提出日時 | 2020-04-17 22:18:40 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 432 ms / 2,000 ms |
| コード長 | 890 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 25,252 KB |
| 最終ジャッジ日時 | 2024-10-03 13:42:53 |
| 合計ジャッジ時間 | 2,978 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
from collections import Counter, defaultdict
def factorization(n):
if n == 1: return [1]
res = []
x = n
y = 2
while y * y <= x:
while x % y == 0:
res.append(y)
x //= y
y += 1
if x > 1: res.append(x)
return res
N, K, M = map(int, input().split())
if N == 1:
print(1)
else:
F = Counter(factorization(N))
D = defaultdict(int)
for x, k in F.items():
for i in range(k * K + 1):
if x**i > M:
D[x] = i - 1
break
else:
D[x] = k * K
dp = defaultdict(int)
dp[1] = True
for x, k in D.items():
tmp = set()
for i in range(k):
for j in dp.keys():
if j * (x**(i + 1)) <= M:
tmp.add(j * (x**(i + 1)))
for x in tmp:
dp[x] = True
print(len(dp))
toyuzuko