結果

問題 No.2299 Antitypoglycemia
ユーザー koarakko5555
提出日時 2023-05-12 21:35:33
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 453 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 80,040 KB
最終ジャッジ日時 2024-11-28 17:31:34
合計ジャッジ時間 3,483 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 RE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def re_factorial(n, mod):
    if n < 2:
        return 1
    return n * re_factorial(n-1, mod) % mod

N, A, B = map(int, input().split())
mod = 998244353

#全体-Aのとき-Bのとき+AかつBのとき

#全体
zentai = re_factorial(N, mod)
#Aのとき
a = re_factorial(N-1, mod)
#Bのとき
b = re_factorial(N-1, mod)
#AかつBのとき
ab = 0
if A!=B:
    ab = re_factorial(N-2, mod)

#print(zentai, a, b, ab)
ans = zentai - a - b + ab
print(ans%mod)
0