結果

問題 No.1529 Constant Lcm
ユーザー convexineqconvexineq
提出日時 2021-06-04 22:27:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 85,888 KB
最終ジャッジ日時 2024-04-30 07:17:16
合計ジャッジ時間 20,188 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,000 KB
testcase_01 AC 40 ms
61,256 KB
testcase_02 WA -
testcase_03 AC 32 ms
53,024 KB
testcase_04 AC 31 ms
53,940 KB
testcase_05 AC 32 ms
53,108 KB
testcase_06 WA -
testcase_07 AC 34 ms
53,780 KB
testcase_08 WA -
testcase_09 AC 33 ms
52,780 KB
testcase_10 AC 1,749 ms
82,588 KB
testcase_11 AC 528 ms
71,324 KB
testcase_12 AC 53 ms
65,440 KB
testcase_13 AC 1,422 ms
81,184 KB
testcase_14 AC 801 ms
74,672 KB
testcase_15 AC 851 ms
75,356 KB
testcase_16 AC 619 ms
71,664 KB
testcase_17 AC 294 ms
67,608 KB
testcase_18 AC 327 ms
68,980 KB
testcase_19 AC 836 ms
74,316 KB
testcase_20 AC 1,975 ms
85,064 KB
testcase_21 AC 1,970 ms
84,952 KB
testcase_22 AC 1,991 ms
85,888 KB
testcase_23 AC 1,681 ms
85,192 KB
testcase_24 AC 1,679 ms
85,656 KB
testcase_25 AC 1,980 ms
84,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Eratosthenes(N): #N以下の素数のリストを返す
    N+=1
    is_prime_list = [True]*N
    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]]

n = int(input())
primes = Eratosthenes(n-1)
MOD = 998244353
r = 1
while primes and primes[-1]**2 >= n:
    p = primes.pop()
    if n%p:
        r = r*p%MOD
    else:
        r = r*p*p%MOD
for p in primes:
    v = 0
    for i in range(1,(n+1)//2):
        k = i*(n-i)
        c = 0
        while k%p == 0:
            k //= p
            c += 1
        if v < c: v = c
    r = r*pow(p,v,MOD)%MOD
print(r)
0