結果
| 問題 |
No.1039 Project Euler でやれ
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 20:47:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,170 bytes |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 53,820 KB |
| 最終ジャッジ日時 | 2025-06-12 20:48:45 |
| 合計ジャッジ時間 | 1,955 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 16 |
ソースコード
MOD = 10**9 + 7
# 分割数表,p(n) 表示将n分解为正整数之和的方式数
divisors = {
0: 1,
1: 1,
2: 2,
3: 3,
4: 5,
5: 7,
6: 11,
7: 15,
8: 22,
9: 30,
10: 42,
11: 56,
12: 77,
13: 101,
14: 135,
15: 176,
16: 231,
17: 297,
18: 385,
19: 490,
20: 627,
}
def get_p(n):
return divisors.get(n, 0)
def prime_factors(M):
factors = {}
if M % 2 == 0:
count = 0
while M % 2 == 0:
count += 1
M = M // 2
factors[2] = count
i = 3
while i * i <= M:
while M % i == 0:
if i not in factors:
factors[i] = 0
factors[i] += 1
M = M // i
i += 2
if M > 1:
factors[M] = 1
return factors
def main():
M = int(input().strip())
if M == 0:
print(0)
return
factors = prime_factors(M)
result = 1
for p in factors:
e = factors[p]
pe = get_p(e)
exponent = e * pe
term = pow(p, exponent, MOD)
result = (result * term) % MOD
print(result)
if __name__ == "__main__":
main()
gew1fw