結果
| 問題 |
No.847 Divisors of Power
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-27 00:34:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 192 ms / 2,000 ms |
| コード長 | 806 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 16,128 KB |
| 最終ジャッジ日時 | 2024-06-28 07:33:33 |
| 合計ジャッジ時間 | 2,314 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
def factorization(N):#素因数分解√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 #[素因数、個数]
N,K,M = map(int,input().split())
if N == 1:
print(1)
exit()
pp = factorization(N)
bb = []
for i in range(len(pp)):
a,b = pp[i]
b = min(b*K,30)
bb.append((a,b))
ans = []
def func(ind,val):
if ind == len(bb):
ans.append(val)
return
a,b = bb[ind]
for i in range(b+1):
if val*(a**i) > M:
break
func(ind+1, val*(a**i))
func(0,1)
print(len(ans))