結果
| 問題 |
No.2318 Phys Bone Maker
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-26 22:43:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 750 bytes |
| コンパイル時間 | 265 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 134,784 KB |
| 最終ジャッジ日時 | 2024-12-25 09:05:18 |
| 合計ジャッジ時間 | 41,116 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 37 TLE * 8 |
ソースコード
from math import gcd
mod = 998244353
N = int(input())
# @LorseKudos(TechTrain) / 約数を高速で列挙するコード(Python)
# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
L = make_divisors(N)
# print(len(L))
def lcm(a, b):
g = gcd(a,b)
return a * b // g
DP = {}
for x in L:
DP[x] = 0
DP[1] = 1
for x in L:
for y in L:
z = lcm(x, y)
if z <= x: continue
DP[z] = (DP[z] + DP[x]) % mod
print(DP[N])