結果

問題 No.1396 Giri
ユーザー convexineqconvexineq
提出日時 2021-02-14 21:33:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 770 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 93,972 KB
最終ジャッジ日時 2023-09-29 14:43:39
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,616 KB
testcase_01 AC 60 ms
71,748 KB
testcase_02 AC 98 ms
93,704 KB
testcase_03 AC 59 ms
71,744 KB
testcase_04 AC 57 ms
71,688 KB
testcase_05 AC 102 ms
93,952 KB
testcase_06 AC 60 ms
71,736 KB
testcase_07 AC 58 ms
71,700 KB
testcase_08 AC 57 ms
71,756 KB
testcase_09 AC 58 ms
71,700 KB
testcase_10 AC 58 ms
71,628 KB
testcase_11 AC 59 ms
71,764 KB
testcase_12 AC 59 ms
71,788 KB
testcase_13 AC 58 ms
71,524 KB
testcase_14 AC 64 ms
72,056 KB
testcase_15 AC 61 ms
71,812 KB
testcase_16 AC 59 ms
71,852 KB
testcase_17 AC 69 ms
76,628 KB
testcase_18 AC 68 ms
77,288 KB
testcase_19 AC 83 ms
85,076 KB
testcase_20 AC 90 ms
88,872 KB
testcase_21 AC 100 ms
91,984 KB
testcase_22 AC 102 ms
93,592 KB
testcase_23 AC 100 ms
93,972 KB
testcase_24 AC 100 ms
93,876 KB
testcase_25 AC 102 ms
93,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Eratosthenes(N): #N以下の素数のリストを返す
    #iが素数のときis_prime_list[i]=1,それ以外は0
    N+=1
    is_prime_list = [True]*N
#    is_prime_list[0], is_prime_list[1] = False, False #リストが必要なときはこの2行を有効化
#    for j in range(4,N,2): is_prime_list[j] = False
    m = int(N**0.5)+1
    for i in range(3,m,2):
        if is_prime_list[i]:
            is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,N,2) if is_prime_list[i]]
#    return is_prime_list

n = int(input())
primes = Eratosthenes(n)
primes.pop()
ans = 1
MOD = 998244353
for p in primes:
    c = 0
    nn = n//p
    while nn:
        c += 1
        nn //= p
    ans *= pow(p,c,MOD)
    ans %= MOD
print(ans)
0