結果

問題 No.2902 ZERO!!
ユーザー detteiuudetteiuu
提出日時 2024-09-27 20:23:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 627 ms / 2,000 ms
コード長 1,590 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,196 KB
実行使用メモリ 113,480 KB
最終ジャッジ日時 2024-09-27 20:23:48
合計ジャッジ時間 11,650 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
59,168 KB
testcase_01 AC 49 ms
59,248 KB
testcase_02 AC 627 ms
113,480 KB
testcase_03 AC 44 ms
59,676 KB
testcase_04 AC 188 ms
83,688 KB
testcase_05 AC 364 ms
93,500 KB
testcase_06 AC 623 ms
112,032 KB
testcase_07 AC 223 ms
85,736 KB
testcase_08 AC 586 ms
109,460 KB
testcase_09 AC 561 ms
108,668 KB
testcase_10 AC 428 ms
100,684 KB
testcase_11 AC 342 ms
94,828 KB
testcase_12 AC 107 ms
78,060 KB
testcase_13 AC 547 ms
109,088 KB
testcase_14 AC 464 ms
101,248 KB
testcase_15 AC 473 ms
104,772 KB
testcase_16 AC 299 ms
92,768 KB
testcase_17 AC 557 ms
108,532 KB
testcase_18 AC 531 ms
106,960 KB
testcase_19 AC 515 ms
103,772 KB
testcase_20 AC 424 ms
98,864 KB
testcase_21 AC 429 ms
101,084 KB
testcase_22 AC 266 ms
87,512 KB
testcase_23 AC 315 ms
93,096 KB
testcase_24 AC 58 ms
74,308 KB
testcase_25 AC 70 ms
76,328 KB
testcase_26 AC 58 ms
73,244 KB
testcase_27 AC 75 ms
76,008 KB
testcase_28 AC 56 ms
74,100 KB
testcase_29 AC 70 ms
76,200 KB
testcase_30 AC 72 ms
76,400 KB
testcase_31 AC 72 ms
76,160 KB
testcase_32 AC 79 ms
76,296 KB
testcase_33 AC 70 ms
76,244 KB
testcase_34 AC 44 ms
59,676 KB
testcase_35 AC 70 ms
75,948 KB
testcase_36 AC 71 ms
76,340 KB
testcase_37 AC 68 ms
76,112 KB
testcase_38 AC 72 ms
76,092 KB
testcase_39 AC 42 ms
59,652 KB
testcase_40 AC 44 ms
59,928 KB
testcase_41 AC 42 ms
59,116 KB
testcase_42 AC 73 ms
76,404 KB
testcase_43 AC 45 ms
60,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Eratosthenes:
    def __init__(self, n):
        self.isPrime = [True]*(n+1)
        self.minfactor = [-1]*(n+1)
        self.isPrime[0], self.isPrime[1] = False, False
        self.minfactor[1] = 1
        for i in range(2, n+1):
            if self.isPrime[i]:
                self.minfactor[i] = i
                for j in range(i*2, n+1, i):
                    self.isPrime[j] = False
                    if self.minfactor[j] == -1:
                        self.minfactor[j] = i
    
    def factorize(self, n):
        factor = []
        while n > 1:
            p = self.minfactor[n]
            cnt = 0
            while self.minfactor[n] == p:
                n //= p
                cnt += 1
            factor.append((p, cnt))
        return factor
    
    def divisor(self, n):
        ans = [1]
        pf = self.factorize(n)
        for p, c in pf:
            L = len(ans)
            for i in range(L):
                v = 1
                for _ in range(c):
                    v *= p
                    ans.append(ans[i]*v)
        return sorted(ans)

N = int(input())

E = Eratosthenes(N)
D = dict()
for i in range(2, N+1):
    for n, c in E.factorize(i):
        if n in D:
            D[n] += c
        else:
            D[n] = c
D = sorted([(n, c) for n, c in D.items()], key=lambda x:x[1], reverse=True)

MOD = 998244353
ans = 0
for i in range(1, 1000000):
    cnt = 1
    for n, c in D:
        if c >= i:
            cnt *= c//i+1
            cnt %= MOD
        else:
            break
    cnt -= 1
    cnt %= MOD
    ans += cnt
    ans %= MOD

print(ans)
0