結果
問題 |
No.847 Divisors of Power
|
ユーザー |
![]() |
提出日時 | 2024-12-04 15:54:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 95,616 KB |
最終ジャッジ日時 | 2024-12-04 15:54:35 |
合計ジャッジ時間 | 3,351 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
import collections 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 def n_fact(N): c = collections.Counter(prime_factorize(N)) return c N,K,M = map(int,input().split()) F = n_fact(N) Q = {1} for k,v in F.items(): Q1 = list(Q) while Q1: x = Q1.pop() for i in range(K * v): x *= k if x > M: break Q.add(x) print(len(Q))