結果

問題 No.1396 Giri
ユーザー ygd.ygd.
提出日時 2021-06-30 23:20:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 20,280 KB
最終ジャッジ日時 2023-09-09 16:25:16
合計ジャッジ時間 2,549 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,540 KB
testcase_01 AC 16 ms
8,492 KB
testcase_02 AC 147 ms
20,108 KB
testcase_03 AC 16 ms
8,620 KB
testcase_04 AC 15 ms
8,468 KB
testcase_05 AC 141 ms
20,280 KB
testcase_06 AC 15 ms
8,460 KB
testcase_07 AC 15 ms
8,652 KB
testcase_08 AC 16 ms
8,496 KB
testcase_09 AC 16 ms
8,668 KB
testcase_10 AC 16 ms
8,488 KB
testcase_11 AC 17 ms
8,612 KB
testcase_12 AC 15 ms
7,932 KB
testcase_13 AC 15 ms
8,484 KB
testcase_14 AC 15 ms
8,444 KB
testcase_15 AC 15 ms
8,496 KB
testcase_16 AC 16 ms
8,576 KB
testcase_17 AC 17 ms
8,672 KB
testcase_18 AC 25 ms
9,324 KB
testcase_19 AC 80 ms
14,500 KB
testcase_20 AC 103 ms
16,984 KB
testcase_21 AC 128 ms
18,744 KB
testcase_22 AC 137 ms
20,088 KB
testcase_23 AC 139 ms
20,036 KB
testcase_24 AC 141 ms
20,020 KB
testcase_25 AC 141 ms
20,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def prime_list(n):
    is_prime = [0] * (n + 1) #素数かどうか。1なら素数。
    is_prime[2] = 1
    for i in range(3, n + 1, 2):
        is_prime[i] = 1
    for i in range(2, int(n ** 0.5) + 1):
        if is_prime[i]:
            for j in range(i * i, n + 1, 2 * i):
                is_prime[j] = 0
    #最後に全部並べる。
    d = []
    for j in range(n + 1):
        if is_prime[j] == 1:
            d.append(j)
    return d, is_prime

def main():
    N = int(input()); MOD = 998244353
    L = prime_list(N)
    #print(L)
    req = L[0][:-1]
    #print(req)
    ans = 1
    for x in req:
        num = 1
        val = x
        while val*x <= N:
            num += 1
            val *= x
        ans *= pow(x,num,MOD)
        ans %= MOD
    print(ans)
if __name__ == '__main__':
    main()
0