結果

問題 No.1396 Giri
ユーザー lloyzlloyz
提出日時 2022-09-23 00:11:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 84,520 KB
最終ジャッジ日時 2023-08-23 20:41:40
合計ジャッジ時間 4,002 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,024 KB
testcase_01 AC 72 ms
71,484 KB
testcase_02 AC 114 ms
84,372 KB
testcase_03 AC 68 ms
71,228 KB
testcase_04 AC 70 ms
71,312 KB
testcase_05 AC 113 ms
84,464 KB
testcase_06 AC 70 ms
71,448 KB
testcase_07 AC 70 ms
71,272 KB
testcase_08 AC 69 ms
71,224 KB
testcase_09 AC 71 ms
71,228 KB
testcase_10 AC 71 ms
71,224 KB
testcase_11 AC 70 ms
71,352 KB
testcase_12 AC 69 ms
71,432 KB
testcase_13 AC 70 ms
71,312 KB
testcase_14 AC 68 ms
71,076 KB
testcase_15 AC 68 ms
71,220 KB
testcase_16 AC 75 ms
75,892 KB
testcase_17 AC 80 ms
76,552 KB
testcase_18 AC 81 ms
77,120 KB
testcase_19 AC 96 ms
80,816 KB
testcase_20 AC 105 ms
82,276 KB
testcase_21 AC 107 ms
83,540 KB
testcase_22 AC 110 ms
84,044 KB
testcase_23 AC 111 ms
84,320 KB
testcase_24 AC 111 ms
84,196 KB
testcase_25 AC 113 ms
84,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 998244353

IsPrime = [True for _ in range(n + 1)]
IsPrime[0] = IsPrime[1] = False
PrimeSet = set()
for i in range(2, n + 1):
    if IsPrime[i]:
        for j in range(i * i, n + 1, i):
            IsPrime[j] = False

maxp = -1
for j in range(n, -1, -1):
    if IsPrime[j]:
        maxp = j
        break

ans = 1
for i in range(2, n + 1):
    if i == maxp:
        continue
    if IsPrime[i]:
        j = i
        while j * i <= n:
            j *= i
        ans *= j
        ans %= mod
print(ans)
0