結果

問題 No.1529 Constant Lcm
ユーザー ああいいああいい
提出日時 2021-12-31 17:49:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 75,940 KB
最終ジャッジ日時 2024-04-17 05:58:22
合計ジャッジ時間 4,785 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,196 KB
testcase_01 WA -
testcase_02 AC 36 ms
52,268 KB
testcase_03 AC 35 ms
53,680 KB
testcase_04 AC 36 ms
52,992 KB
testcase_05 AC 36 ms
52,280 KB
testcase_06 AC 37 ms
52,480 KB
testcase_07 AC 37 ms
52,208 KB
testcase_08 AC 36 ms
51,752 KB
testcase_09 AC 37 ms
53,676 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
P = 998244353

def lcm(a,b):
    u,v = a,b
    while True:
        r = a % b
        a = b
        b = r
        if r == 0:
            break
    return u // a * v % P
ans = 1
i = 1
while i <= N - i:
    ans = lcm(ans,i * (N - i))
    i += 1
print(ans)
0