結果
| 問題 | No.2318 Phys Bone Maker |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-26 22:43:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 750 bytes |
| 記録 | |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 85,888 KB |
| 実行使用メモリ | 134,528 KB |
| 最終ジャッジ日時 | 2026-05-31 00:59:15 |
| 合計ジャッジ時間 | 5,007 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 45 |
ソースコード
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])