結果
問題 | No.2299 Antitypoglycemia |
ユーザー |
![]() |
提出日時 | 2023-05-12 21:44:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 819 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 506 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 112,608 KB |
最終ジャッジ日時 | 2024-11-28 17:49:26 |
合計ジャッジ時間 | 8,926 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
import sys sys.setrecursionlimit(10**5) import math def re_factorial(n): if n < 2: return 1 return n * re_factorial(n-1) N, A, B = map(int, input().split()) mod = 998244353 #全体-Aのとき-Bのとき+AかつBのとき #全体 #zentai = re_factorial(N) zentai = math.factorial(N) #Aのとき #a = re_factorial(N-1) a = math.factorial(N-1) b = a #Bのとき #b = re_factorial(N-1) #AかつBのとき ab = 0 if A!=B: ab = math.factorial(N-2) #print(zentai, a, b, ab) ans = zentai - a - b + ab print(ans%mod)