結果

問題 No.2318 Phys Bone Maker
ユーザー amentorimaru
提出日時 2023-02-22 02:11:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,186 ms / 3,000 ms
コード長 1,086 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 76,220 KB
最終ジャッジ日時 2024-09-18 12:55:02
合計ジャッジ時間 11,944 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
input = sys.stdin.readline
def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for _ in range(N)]
            
def main():
    n=int(input())
    l=list()
    for v in range(1,int(math.sqrt(n))+1):
        if n%v==0:
            l.append(v)
            if v < n//v: l.append(n//v)

    l.sort()
    s=len(l)
    p=list()
    for v in l:
        if v==1 or n%v:continue
        p.append(v)
        while n%v==0: n//=v        

    dp=[0]*s
    dp[0]=1
    for i in range(s):
        for j in range(i+1,s):
            if l[j]%l[i]!=0:continue
            v=l[j]//l[i]
            add=dp[i]
            for pv in p:
                if v%pv==0:continue
                cnt=1
                vi=l[i]
                while vi%pv==0:
                    vi//=pv
                    cnt+=1
                add*=cnt
            dp[j]=(dp[j]+add)%998244353
    print(dp[-1])
        
if __name__ == "__main__":
    main()
0