結果

問題 No.2318 Phys Bone Maker
ユーザー amentorimaru
提出日時 2023-02-26 03:13:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,322 ms / 3,000 ms
コード長 928 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-09-18 12:57:29
合計ジャッジ時間 13,385 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
input = sys.stdin.readline
            
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 and n%v == 0:            
            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