結果

問題 No.1396 Giri
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-05 16:39:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 89,040 KB
最終ジャッジ日時 2023-09-21 14:04:43
合計ジャッジ時間 3,972 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,348 KB
testcase_01 AC 70 ms
71,384 KB
testcase_02 AC 114 ms
88,896 KB
testcase_03 AC 71 ms
71,260 KB
testcase_04 AC 74 ms
71,176 KB
testcase_05 AC 116 ms
88,924 KB
testcase_06 AC 70 ms
71,508 KB
testcase_07 AC 70 ms
71,428 KB
testcase_08 AC 69 ms
71,520 KB
testcase_09 AC 69 ms
71,336 KB
testcase_10 AC 71 ms
71,044 KB
testcase_11 AC 68 ms
71,252 KB
testcase_12 AC 70 ms
71,300 KB
testcase_13 AC 70 ms
71,260 KB
testcase_14 AC 69 ms
71,560 KB
testcase_15 AC 70 ms
71,440 KB
testcase_16 AC 72 ms
75,416 KB
testcase_17 AC 77 ms
76,536 KB
testcase_18 AC 79 ms
77,112 KB
testcase_19 AC 96 ms
82,700 KB
testcase_20 AC 103 ms
85,476 KB
testcase_21 AC 110 ms
87,572 KB
testcase_22 AC 115 ms
88,928 KB
testcase_23 AC 115 ms
88,888 KB
testcase_24 AC 114 ms
89,040 KB
testcase_25 AC 116 ms
88,644 KB
権限があれば一括ダウンロードができます

ソースコード

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