結果

問題 No.847 Divisors of Power
ユーザー rin204
提出日時 2022-01-19 00:34:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 110,208 KB
最終ジャッジ日時 2024-11-23 13:39:02
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, m = map(int, input().split())
cnt = {}
for i in range(2, int(n ** 0.5 + 1)):
    if n % i == 0:
        while n % i == 0:
            n //= i
            cnt[i] = cnt.get(i, 0) + k

if n != 1:
    cnt[n] = k

se = {1}
for k, v in cnt.items():
    times = 1
    se2 = set()
    for _ in range(v + 1):
        for s in se:
            if times * s <= m:
                se2.add(times * s)
        times *= k
        if times > m:
            break
    se = se2
print(len(se))
0