結果

問題 No.1529 Constant Lcm
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-06-04 20:39:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 822 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 93,056 KB
最終ジャッジ日時 2024-04-30 00:12:16
合計ジャッジ時間 5,345 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
57,216 KB
testcase_01 AC 84 ms
69,376 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 41 ms
51,712 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 41 ms
51,712 KB
testcase_06 AC 40 ms
51,712 KB
testcase_07 AC 42 ms
51,712 KB
testcase_08 AC 40 ms
52,224 KB
testcase_09 AC 40 ms
51,712 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

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