結果
| 問題 |
No.847 Divisors of Power
|
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2021-01-05 11:56:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 2,000 ms |
| コード長 | 751 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 78,848 KB |
| 最終ジャッジ日時 | 2024-10-15 18:48:15 |
| 合計ジャッジ時間 | 2,597 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
N,K,M=map(int, input().split())
if N==1:
print(1)
exit()
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
arr.append([temp, 1])
if arr==[]:
arr.append([n, 1])
return arr
A=factorization(N)
a=len(A)
#print(A)
D=[]
for a,b in A:
D.append((a,b*K))
#print(D)
from collections import deque
d=deque()
d.append(1)
nd=deque()
ans=0
for i in range(len(D)):
while len(d):
p=d.popleft()
s,t=D[i]
n=0
while p*pow(s,n)<=M and n<=t:
nd.append(p*pow(s,n))
n+=1
d=nd
nd=deque()
print(len(d))
timi