結果

問題 No.1039 Project Euler でやれ
ユーザー gew1fw
提出日時 2025-06-12 20:49:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 53,896 KB
最終ジャッジ日時 2025-06-12 20:52:08
合計ジャッジ時間 1,644 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

partition = [1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627]

def factorize(n):
    factors = {}
    while n % 2 == 0:
        factors[2] = factors.get(2, 0) + 1
        n = n // 2
    i = 3
    while i * i <= n:
        while n % i == 0:
            factors[i] = factors.get(i, 0) + 1
            n = n // i
        i += 2
    if n > 1:
        factors[n] = 1
    return factors

M = int(input())
if M == 0:
    print(0)
else:
    factors = factorize(M)
    c = 1
    for k in factors.values():
        c *= partition[k]
    MOD = 10**9 + 7
    result = pow(M, c, MOD)
    print(result)
0