結果

問題 No.847 Divisors of Power
ユーザー kekurekekure
提出日時 2019-07-08 12:45:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,076 KB
最終ジャッジ日時 2024-04-16 09:12:29
合計ジャッジ時間 2,704 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 40 ms
51,968 KB
testcase_03 AC 46 ms
51,712 KB
testcase_04 AC 42 ms
52,352 KB
testcase_05 AC 43 ms
52,096 KB
testcase_06 AC 44 ms
56,960 KB
testcase_07 AC 40 ms
51,968 KB
testcase_08 AC 43 ms
57,856 KB
testcase_09 AC 43 ms
57,472 KB
testcase_10 AC 41 ms
52,480 KB
testcase_11 AC 44 ms
52,864 KB
testcase_12 AC 44 ms
57,344 KB
testcase_13 AC 46 ms
58,880 KB
testcase_14 AC 42 ms
52,992 KB
testcase_15 AC 126 ms
76,288 KB
testcase_16 AC 45 ms
56,960 KB
testcase_17 AC 44 ms
57,472 KB
testcase_18 AC 48 ms
60,160 KB
testcase_19 AC 62 ms
68,480 KB
testcase_20 AC 44 ms
57,344 KB
testcase_21 AC 119 ms
77,076 KB
testcase_22 AC 46 ms
57,216 KB
testcase_23 AC 49 ms
57,088 KB
testcase_24 AC 127 ms
76,424 KB
testcase_25 AC 41 ms
52,352 KB
testcase_26 AC 39 ms
51,968 KB
testcase_27 AC 43 ms
57,856 KB
testcase_28 AC 39 ms
51,968 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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):
        sum = count(mass * (fact[k][0] ** i), fact, k + 1, M, leng)
        if sum == 0:
            break
        else:
            cnt += sum
    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