結果
| 問題 |
No.847 Divisors of Power
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-18 21:45:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 118 ms / 2,000 ms |
| コード長 | 763 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 76,160 KB |
| 最終ジャッジ日時 | 2024-09-15 02:46:25 |
| 合計ジャッジ時間 | 2,607 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
def prime_factorize(N): #素因数分解
exponent = 0
while N%2 == 0:
exponent += 1
N //= 2
if exponent: factorization = [[2,exponent*k]]
else: factorization = []
i=1
while i*i <=N:
i += 2
if N%i: continue
exponent = 0
while N%i == 0:
exponent += 1
N //= i
factorization.append([i,exponent*k])
if N!= 1: factorization.append([N,k])
assert N != 0, "zero"
return factorization
n,k,m = map(int,input().split())
fac = prime_factorize(n)
L = len(fac)
ans = 0
def dfs(x,i):
global ans
if i >= L:
ans += 1
return
p,c = fac[i]
while x <= m and c >= 0:
dfs(x,i+1)
x *= p
c -= 1
dfs(1,0)
print(ans)
convexineq