結果
問題 |
No.2318 Phys Bone Maker
|
ユーザー |
![]() |
提出日時 | 2023-05-27 19:21:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,125 ms / 3,000 ms |
コード長 | 1,082 bytes |
コンパイル時間 | 210 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 79,488 KB |
最終ジャッジ日時 | 2024-12-26 03:10:32 |
合計ジャッジ時間 | 21,768 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
from collections import * def div(n): if n <= 0: return [] S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return sorted(list(S)) def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) return dict(arr) N = int(input()) mod = 998244353 L = div(N) M = len(L) ans = [0] * M ans[0] = 1 dic = [] for i in range(M): dic.append(factorization(L[i])) for i in range(M): for j in range(i + 1, M): val = ans[i] if L[j] % L[i] != 0: continue for k, v in dic[j].items(): if k not in dic[i]: continue else: if dic[i][k] == v: val *= v + 1 val %= mod ans[j] += val ans[j] %= mod print(ans[-1])