結果

問題 No.1396 Giri
ユーザー brthyyjp
提出日時 2021-12-05 16:39:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 74,112 KB
最終ジャッジ日時 2024-07-07 07:52:31
合計ジャッジ時間 2,248 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

import math

def sieve(n):
    ass = []
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(math.sqrt(n))+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    for i in range(n+1):
        if is_prime[i]:
            ass.append(i)
    return(ass)

mod = 998244353

P = sieve(n)
M = max(P)
l = 1
for p in P:
    if p == M:
        continue
    x = 1
    cnt = 0
    while True:
        if x*p <= n:
            cnt += 1
            x *= p
        else:
            break
    l *= pow(p, cnt, mod)
    l %= mod
print(l)
0