結果

問題 No.847 Divisors of Power
ユーザー 👑 tamatotamato
提出日時 2020-03-20 20:15:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 920 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 88,392 KB
最終ジャッジ日時 2023-08-21 07:43:27
合計ジャッジ時間 4,600 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,980 KB
testcase_01 AC 67 ms
71,648 KB
testcase_02 AC 67 ms
71,812 KB
testcase_03 AC 72 ms
71,564 KB
testcase_04 AC 68 ms
71,452 KB
testcase_05 AC 69 ms
71,748 KB
testcase_06 AC 70 ms
75,828 KB
testcase_07 AC 71 ms
75,800 KB
testcase_08 AC 71 ms
75,868 KB
testcase_09 AC 69 ms
75,816 KB
testcase_10 AC 71 ms
75,752 KB
testcase_11 AC 73 ms
75,812 KB
testcase_12 AC 72 ms
75,544 KB
testcase_13 AC 76 ms
76,988 KB
testcase_14 AC 73 ms
75,880 KB
testcase_15 AC 96 ms
88,392 KB
testcase_16 AC 72 ms
75,636 KB
testcase_17 AC 74 ms
75,748 KB
testcase_18 AC 76 ms
76,948 KB
testcase_19 AC 77 ms
76,904 KB
testcase_20 AC 72 ms
75,760 KB
testcase_21 AC 81 ms
78,936 KB
testcase_22 AC 71 ms
76,232 KB
testcase_23 AC 74 ms
75,488 KB
testcase_24 AC 95 ms
87,304 KB
testcase_25 AC 70 ms
71,496 KB
testcase_26 AC 69 ms
71,616 KB
testcase_27 AC 71 ms
75,544 KB
testcase_28 AC 67 ms
71,976 KB
testcase_29 AC 68 ms
71,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

    N, K, M = map(int, input().split())
    prime = PrimeDecomposition(N)
    for p in prime:
        prime[p] *= K
    ans = [1]
    for p in prime:
        ans_new = []
        for a in ans:
            for k in range(prime[p]+1):
                a_new = a * pow(p, k)
                if a_new <= M:
                    ans_new.append(a_new)
                else:
                    break
        ans = ans_new
    print(len(ans))


if __name__ == '__main__':
    main()
0