結果

問題 No.1529 Constant Lcm
ユーザー hir355hir355
提出日時 2021-06-04 20:55:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 3,000 ms
コード長 654 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 89,100 KB
最終ジャッジ日時 2023-08-12 10:29:47
合計ジャッジ時間 4,602 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,632 KB
testcase_01 AC 83 ms
75,628 KB
testcase_02 AC 80 ms
71,508 KB
testcase_03 AC 79 ms
71,648 KB
testcase_04 AC 79 ms
71,584 KB
testcase_05 AC 78 ms
71,436 KB
testcase_06 AC 78 ms
71,772 KB
testcase_07 AC 79 ms
71,864 KB
testcase_08 AC 80 ms
71,540 KB
testcase_09 AC 80 ms
71,648 KB
testcase_10 AC 123 ms
87,680 KB
testcase_11 AC 101 ms
80,552 KB
testcase_12 AC 86 ms
76,832 KB
testcase_13 AC 122 ms
86,248 KB
testcase_14 AC 107 ms
82,588 KB
testcase_15 AC 108 ms
82,960 KB
testcase_16 AC 103 ms
81,416 KB
testcase_17 AC 97 ms
78,776 KB
testcase_18 AC 96 ms
79,080 KB
testcase_19 AC 107 ms
82,680 KB
testcase_20 AC 135 ms
89,060 KB
testcase_21 AC 127 ms
88,864 KB
testcase_22 AC 128 ms
88,848 KB
testcase_23 AC 132 ms
88,736 KB
testcase_24 AC 136 ms
89,100 KB
testcase_25 AC 131 ms
88,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

from math import gcd
MOD = 998244353
n = int(input())
ans = 1
pr = primes(n)
for p in pr:
    t = 1
    x = p
    while x < n:
        y = x
        if t < x:
            t = x
        while y < n:
            if (n % y) % x == 0 and t < x * y:
                t = x * y
            y *= p
        x *= p
    ans *= t
    ans %= MOD
print(ans)
0