結果

問題 No.2318 Phys Bone Maker
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-27 10:20:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 751 ms / 3,000 ms
コード長 974 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 79,476 KB
最終ジャッジ日時 2023-08-26 19:04:58
合計ジャッジ時間 11,477 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,668 KB
testcase_01 AC 62 ms
71,496 KB
testcase_02 AC 751 ms
79,476 KB
testcase_03 AC 83 ms
76,816 KB
testcase_04 AC 85 ms
76,256 KB
testcase_05 AC 81 ms
76,172 KB
testcase_06 AC 82 ms
76,132 KB
testcase_07 AC 76 ms
76,900 KB
testcase_08 AC 87 ms
77,048 KB
testcase_09 AC 79 ms
76,072 KB
testcase_10 AC 95 ms
76,060 KB
testcase_11 AC 86 ms
76,532 KB
testcase_12 AC 102 ms
76,952 KB
testcase_13 AC 105 ms
76,848 KB
testcase_14 AC 83 ms
76,060 KB
testcase_15 AC 85 ms
76,060 KB
testcase_16 AC 82 ms
75,932 KB
testcase_17 AC 93 ms
76,824 KB
testcase_18 AC 107 ms
76,724 KB
testcase_19 AC 83 ms
76,076 KB
testcase_20 AC 90 ms
76,316 KB
testcase_21 AC 85 ms
75,924 KB
testcase_22 AC 83 ms
76,628 KB
testcase_23 AC 81 ms
76,340 KB
testcase_24 AC 92 ms
76,060 KB
testcase_25 AC 87 ms
76,092 KB
testcase_26 AC 95 ms
76,700 KB
testcase_27 AC 90 ms
75,932 KB
testcase_28 AC 80 ms
75,852 KB
testcase_29 AC 79 ms
76,248 KB
testcase_30 AC 76 ms
75,884 KB
testcase_31 AC 94 ms
75,968 KB
testcase_32 AC 92 ms
75,916 KB
testcase_33 AC 64 ms
71,868 KB
testcase_34 AC 91 ms
76,016 KB
testcase_35 AC 169 ms
78,032 KB
testcase_36 AC 420 ms
78,532 KB
testcase_37 AC 411 ms
78,852 KB
testcase_38 AC 415 ms
78,868 KB
testcase_39 AC 582 ms
78,880 KB
testcase_40 AC 570 ms
79,000 KB
testcase_41 AC 661 ms
79,084 KB
testcase_42 AC 655 ms
78,908 KB
testcase_43 AC 108 ms
76,960 KB
testcase_44 AC 181 ms
78,060 KB
testcase_45 AC 177 ms
78,100 KB
testcase_46 AC 664 ms
79,252 KB
testcase_47 AC 92 ms
76,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(input())
mod = 998244353

divs = set()
for i in range(1,int(n**0.5)+1):
    if n%i:
        continue
    divs.add(i)
    divs.add(n//i)

divs = sorted(divs)
le = len(divs)
primes = []


for i in range(2,int(n**0.5)+1):
    if n%i:
        continue
    primes.append(i)
    while n % i == 0:
        n //= i

if n != 1:
    primes.append(n)

div_count = [[0]*len(primes) for i in range(le)]

for i,div in enumerate(divs):
    now = div
    for j,prime in enumerate(primes):
        while now%prime == 0:
            now //= prime
            div_count[i][j] += 1

dp = [0]*le
dp[0] = 1
lp = len(primes)

for i in range(le-1):
    divi = div_count[i]
    for j in range(i+1,le):
        if divs[j]%divs[i]:
            continue
        divj = div_count[j]
        pat = 1
        for x in range(lp):
            if divi[x] == divj[x]:
                pat *= divi[x]+1
                pat %= mod
        dp[j] += dp[i]*pat
        dp[j] %= mod
print(dp[-1])
0