結果

問題 No.847 Divisors of Power
ユーザー kekurekekure
提出日時 2019-07-08 12:42:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 871 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 84,624 KB
最終ジャッジ日時 2024-04-16 09:11:51
合計ジャッジ時間 4,747 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
57,728 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 64 ms
75,236 KB
testcase_04 AC 135 ms
75,920 KB
testcase_05 AC 88 ms
75,344 KB
testcase_06 AC 43 ms
56,960 KB
testcase_07 AC 42 ms
52,096 KB
testcase_08 AC 45 ms
57,088 KB
testcase_09 AC 46 ms
58,560 KB
testcase_10 AC 46 ms
58,752 KB
testcase_11 AC 58 ms
67,072 KB
testcase_12 AC 45 ms
58,240 KB
testcase_13 AC 62 ms
72,320 KB
testcase_14 AC 57 ms
65,536 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def factoring(n):
    i = 2
    fact = []
    while True:
        if n < i * i:
            break
        if n % i == 0:
            fact.append(i)
            n //= i
        else:
            i += 1
    fact.append(n)
    t = fact[0]
    fact_converted = []
    cnt = 0
    for x in fact:
        if t == x:
            cnt += 1
        else:
            fact_converted.append([t, cnt])
            t = x
            cnt = 1
    fact_converted.append([t, cnt])

    return fact_converted


def count(mass, fact, k, M, leng):
    if mass > M:
        return 0
    if k == leng:
        return 1
    cnt = 0
    for i in range(fact[k][1] + 1):
        cnt += count(mass * (fact[k][0] ** i), fact, k + 1, M, leng)

    return cnt


N, K, M = map(int, input().split())
fact = [[x[0], x[1] * K] for x in factoring(N)]
leng = len(fact)
print (count(1, fact, 0, M, leng))




0