結果

問題 No.1529 Constant Lcm
ユーザー 👑 rin204rin204
提出日時 2022-01-27 00:24:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 234 ms / 3,000 ms
コード長 555 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 97,688 KB
最終ジャッジ日時 2023-08-25 13:43:10
合計ジャッジ時間 5,400 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,416 KB
testcase_01 AC 82 ms
76,168 KB
testcase_02 AC 72 ms
71,344 KB
testcase_03 AC 70 ms
71,376 KB
testcase_04 AC 70 ms
71,160 KB
testcase_05 AC 71 ms
71,088 KB
testcase_06 AC 72 ms
71,408 KB
testcase_07 AC 72 ms
71,188 KB
testcase_08 AC 71 ms
71,388 KB
testcase_09 AC 72 ms
71,376 KB
testcase_10 AC 227 ms
97,044 KB
testcase_11 AC 138 ms
82,708 KB
testcase_12 AC 91 ms
77,060 KB
testcase_13 AC 194 ms
91,976 KB
testcase_14 AC 153 ms
85,832 KB
testcase_15 AC 159 ms
86,996 KB
testcase_16 AC 142 ms
83,908 KB
testcase_17 AC 115 ms
80,256 KB
testcase_18 AC 118 ms
80,424 KB
testcase_19 AC 152 ms
85,892 KB
testcase_20 AC 225 ms
95,860 KB
testcase_21 AC 225 ms
95,896 KB
testcase_22 AC 227 ms
96,196 KB
testcase_23 AC 226 ms
95,860 KB
testcase_24 AC 228 ms
96,408 KB
testcase_25 AC 234 ms
97,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())

isprime = [True] * n
div = {}
for i in range(2, n):
    if not isprime[i]:
        continue
    max_ = 1
    for j in range(i * i, n, i):
        isprime[j] = False
        cnt = 0
        while j % i == 0:
            j //= i
            cnt += 1
        max_ = max(max_, cnt)
    if n % i == 0:
        m = n - i ** max_
        while m % i == 0:
            max_ += 1
            m //= i
    div[i] = max_

ans = 1
for k, v in div.items():
    for _ in range(v):
        ans *= k
        ans %= MOD
print(ans % MOD)

0