結果

問題 No.1396 Giri
ユーザー rlangevinrlangevin
提出日時 2023-02-01 00:30:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 95,844 KB
最終ジャッジ日時 2023-09-13 15:35:33
合計ジャッジ時間 3,987 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,508 KB
testcase_01 AC 70 ms
71,212 KB
testcase_02 AC 141 ms
95,508 KB
testcase_03 AC 68 ms
71,368 KB
testcase_04 AC 68 ms
71,240 KB
testcase_05 AC 121 ms
95,684 KB
testcase_06 AC 68 ms
71,516 KB
testcase_07 AC 70 ms
71,388 KB
testcase_08 AC 68 ms
71,328 KB
testcase_09 AC 71 ms
71,420 KB
testcase_10 AC 70 ms
71,240 KB
testcase_11 AC 69 ms
71,200 KB
testcase_12 AC 71 ms
71,440 KB
testcase_13 AC 70 ms
71,288 KB
testcase_14 AC 70 ms
71,368 KB
testcase_15 AC 71 ms
71,392 KB
testcase_16 AC 75 ms
75,420 KB
testcase_17 AC 79 ms
76,676 KB
testcase_18 AC 81 ms
77,176 KB
testcase_19 AC 103 ms
85,852 KB
testcase_20 AC 112 ms
91,144 KB
testcase_21 AC 120 ms
93,368 KB
testcase_22 AC 122 ms
95,560 KB
testcase_23 AC 126 ms
95,688 KB
testcase_24 AC 123 ms
95,672 KB
testcase_25 AC 124 ms
95,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *


def Sieve(n):
    lst = [True] * (n + 1)
    S = set()
    for i in range(2, ceil(sqrt(n)) + 1):
        if lst[i]:
            for j in range(2 * i, n + 1, i):
                lst[j] = False
    for i in range(2, n + 1):
        if lst[i]:
            S.add(i)
    return S

N = int(input())
mod = 998244353
S = Sieve(N)
maxv = max(S)
ans = 1
for i in S:
    if i == maxv:
        continue
    val = 1
    while val <= N:
        val *= i
    val //= i
    ans *= val
    ans %= mod
print(ans)
0