結果

問題 No.1396 Giri
ユーザー AEnAEn
提出日時 2022-06-15 00:51:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 69,968 KB
最終ジャッジ日時 2024-04-14 06:43:22
合計ジャッジ時間 2,782 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,880 KB
testcase_01 AC 39 ms
52,704 KB
testcase_02 AC 81 ms
69,604 KB
testcase_03 AC 38 ms
52,412 KB
testcase_04 AC 38 ms
53,728 KB
testcase_05 AC 82 ms
69,760 KB
testcase_06 AC 38 ms
53,744 KB
testcase_07 AC 37 ms
53,004 KB
testcase_08 AC 39 ms
52,836 KB
testcase_09 AC 38 ms
53,784 KB
testcase_10 AC 38 ms
54,148 KB
testcase_11 AC 38 ms
53,308 KB
testcase_12 AC 38 ms
53,068 KB
testcase_13 AC 38 ms
53,188 KB
testcase_14 AC 38 ms
53,960 KB
testcase_15 AC 39 ms
52,384 KB
testcase_16 AC 43 ms
60,716 KB
testcase_17 AC 45 ms
60,412 KB
testcase_18 AC 48 ms
61,868 KB
testcase_19 AC 64 ms
66,404 KB
testcase_20 AC 70 ms
66,932 KB
testcase_21 AC 79 ms
69,340 KB
testcase_22 AC 80 ms
69,624 KB
testcase_23 AC 82 ms
69,968 KB
testcase_24 AC 83 ms
69,636 KB
testcase_25 AC 81 ms
69,400 KB
権限があれば一括ダウンロードができます

ソースコード

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