結果

問題 No.1529 Constant Lcm
ユーザー aaaaaaaaaa2230
提出日時 2021-06-04 20:39:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 822 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 157,696 KB
最終ジャッジ日時 2024-11-19 09:56:21
合計ジャッジ時間 61,974 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 998244353
prime = [0]*(n+1)
p = []
for i in range(2,n+1):
    if prime[i]:
        continue
    p.append(i)
    for j in range(i,n+1,i):
        prime[j] = 1

count = {}
for i in range(1,n//2+1):
    dic = {}
    now = i
    for j in p:
        if j > now:
            break
        if now%j:
            continue
        c = 0
        while now%j == 0:
            now //= j
            c += 1
        dic[j] = dic.get(j,0)+c
    now = n-i
    for j in p:
        if j > now:
            break
        if now%j:
            continue
        c = 0
        while now%j == 0:
            now //= j
            c += 1
        dic[j] = dic.get(j,0)+c
    for k,v in dic.items():
        count[k] = max(count.get(k,0),v)
ans = 1
for k,v in count.items():
    ans *= pow(k,v,mod)
    ans %= mod
print(ans)
0