結果

問題 No.1396 Giri
ユーザー AEn
提出日時 2022-06-15 00:51:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 69,376 KB
最終ジャッジ日時 2024-10-03 03:59:33
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def sieve_of_eratosthenes(n):
    prime = [True]*(n+1)
    prime[0] = False
    prime[1] = False

    sqrt_n = math.ceil(math.sqrt(n))
    for i in range(2, sqrt_n+1):
        if prime[i]:
            for j in range(2*i, n+1, i):
                prime[j] = False

    return prime

N = int(input())
p = sieve_of_eratosthenes(N)
for i in reversed(range(N+1)):
    if p[i]:
        pp = i
        break

res = 1
mod = 998244353
for i in range(2,len(p)):
    if i == pp:
        break
    if p[i]:
        c = math.log(N)/math.log(i)
        res *= pow(i, int(c), mod)
        res %= mod
print(res)
0