結果

問題 No.847 Divisors of Power
ユーザー vwxyzvwxyz
提出日時 2022-05-12 21:15:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 17,956 KB
最終ジャッジ日時 2023-09-27 21:04:36
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,788 KB
testcase_01 AC 19 ms
8,840 KB
testcase_02 AC 18 ms
8,692 KB
testcase_03 AC 19 ms
8,732 KB
testcase_04 AC 19 ms
8,804 KB
testcase_05 AC 19 ms
8,744 KB
testcase_06 AC 22 ms
8,780 KB
testcase_07 AC 21 ms
8,788 KB
testcase_08 AC 22 ms
8,740 KB
testcase_09 AC 21 ms
8,872 KB
testcase_10 AC 20 ms
8,708 KB
testcase_11 AC 22 ms
8,860 KB
testcase_12 AC 21 ms
8,732 KB
testcase_13 AC 21 ms
8,736 KB
testcase_14 AC 21 ms
8,748 KB
testcase_15 AC 188 ms
16,428 KB
testcase_16 AC 22 ms
8,652 KB
testcase_17 AC 22 ms
8,656 KB
testcase_18 AC 23 ms
8,828 KB
testcase_19 AC 24 ms
8,952 KB
testcase_20 AC 21 ms
8,692 KB
testcase_21 AC 71 ms
11,196 KB
testcase_22 AC 22 ms
8,788 KB
testcase_23 AC 23 ms
8,712 KB
testcase_24 AC 224 ms
17,956 KB
testcase_25 AC 23 ms
8,800 KB
testcase_26 AC 19 ms
8,712 KB
testcase_27 AC 22 ms
8,772 KB
testcase_28 AC 19 ms
8,708 KB
testcase_29 AC 19 ms
8,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
readline=sys.stdin.readline

N,K,M=map(int,readline().split())
fact=defaultdict(int)
for p in range(2,int(N**.5)+1):
    while N%p==0:
        N//=p
        fact[p]+=K
if N!=1:
    fact[N]+=K
queue=[1]
for p,e in fact.items():
    prev=queue
    queue=[]
    pow_p=1
    for c in range(e+1):
        if M<pow_p:
            break
        for x in prev:
            if x*pow_p<=M:
                queue.append(x*pow_p)
        pow_p*=p
ans=len(queue)
print(ans)
0