結果

問題 No.2299 Antitypoglycemia
ユーザー nautnaut
提出日時 2023-08-26 09:56:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 10,616 KB
実行使用メモリ 15,932 KB
最終ジャッジ日時 2023-08-26 09:56:49
合計ジャッジ時間 2,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,868 KB
testcase_01 AC 15 ms
7,896 KB
testcase_02 AC 13 ms
7,908 KB
testcase_03 AC 34 ms
13,144 KB
testcase_04 AC 34 ms
13,408 KB
testcase_05 AC 26 ms
11,424 KB
testcase_06 AC 34 ms
13,180 KB
testcase_07 AC 18 ms
9,384 KB
testcase_08 AC 33 ms
12,816 KB
testcase_09 AC 33 ms
13,468 KB
testcase_10 AC 24 ms
10,052 KB
testcase_11 AC 21 ms
10,148 KB
testcase_12 AC 35 ms
13,872 KB
testcase_13 AC 43 ms
15,496 KB
testcase_14 AC 16 ms
8,844 KB
testcase_15 AC 16 ms
8,812 KB
testcase_16 AC 24 ms
10,308 KB
testcase_17 AC 20 ms
9,596 KB
testcase_18 AC 45 ms
15,900 KB
testcase_19 AC 48 ms
15,828 KB
testcase_20 AC 45 ms
15,932 KB
testcase_21 AC 45 ms
15,752 KB
testcase_22 AC 46 ms
15,760 KB
testcase_23 AC 13 ms
7,832 KB
testcase_24 AC 14 ms
7,868 KB
testcase_25 AC 13 ms
7,720 KB
testcase_26 AC 13 ms
7,804 KB
testcase_27 AC 14 ms
7,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998_244_353

def main():
    N, A, B = map(int, input().split())

    fact = [1]

    for i in range(1, N + 1):
        fact.append((fact[-1] * i) % MOD)

    ans = (fact[N] - fact[N - 1] * 2) % MOD
    
    if A != B:
        ans += fact[N - 2]
    
    ans += MOD
    ans %= MOD
    print(ans)
    return 0

main()
0