結果

問題 No.847 Divisors of Power
ユーザー terasaterasa
提出日時 2022-06-06 00:40:48
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,270 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 75,844 KB
最終ジャッジ日時 2023-10-21 03:23:00
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,588 KB
testcase_01 AC 41 ms
55,588 KB
testcase_02 AC 41 ms
55,588 KB
testcase_03 AC 41 ms
55,588 KB
testcase_04 AC 46 ms
55,588 KB
testcase_05 AC 43 ms
55,588 KB
testcase_06 AC 50 ms
61,688 KB
testcase_07 AC 47 ms
61,680 KB
testcase_08 AC 46 ms
61,680 KB
testcase_09 AC 47 ms
61,680 KB
testcase_10 AC 50 ms
61,680 KB
testcase_11 AC 49 ms
61,680 KB
testcase_12 AC 46 ms
61,680 KB
testcase_13 AC 50 ms
61,848 KB
testcase_14 AC 47 ms
61,680 KB
testcase_15 AC 96 ms
75,844 KB
testcase_16 AC 48 ms
61,680 KB
testcase_17 AC 46 ms
61,680 KB
testcase_18 AC 53 ms
66,304 KB
testcase_19 AC 62 ms
70,468 KB
testcase_20 AC 45 ms
61,680 KB
testcase_21 AC 72 ms
75,844 KB
testcase_22 AC 46 ms
61,688 KB
testcase_23 AC 45 ms
61,680 KB
testcase_24 AC 97 ms
75,832 KB
testcase_25 AC 47 ms
61,680 KB
testcase_26 AC 42 ms
55,624 KB
testcase_27 AC 45 ms
61,680 KB
testcase_28 AC 42 ms
55,624 KB
testcase_29 AC 41 ms
55,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N, K, M = map(int, input().split())
factors = defaultdict(int)
n = N
for i in range(2, N + 1):
    if i * i > N:
        break
    while n % i == 0:
        factors[i] += 1
        n //= i
if n > 1:
    factors[n] += 1
A = [(k, v) for k, v in factors.items()]


def dfs(n, idx):
    global ans
    if idx == len(A):
        ans += 1
        return

    k, v = A[idx]
    for i in range(v * K + 1):
        if n * pow(k, i) > M:
            break
        dfs(n * pow(k, i), idx + 1)


ans = 0
dfs(1, 0)
print(ans)
0