結果

問題 No.2299 Antitypoglycemia
ユーザー lloyzlloyz
提出日時 2023-05-12 21:29:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 77,380 KB
最終ジャッジ日時 2023-08-19 03:56:02
合計ジャッジ時間 3,218 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,328 KB
testcase_01 AC 63 ms
71,348 KB
testcase_02 AC 68 ms
71,340 KB
testcase_03 AC 71 ms
76,644 KB
testcase_04 AC 70 ms
76,864 KB
testcase_05 AC 64 ms
76,260 KB
testcase_06 AC 63 ms
76,728 KB
testcase_07 AC 69 ms
75,732 KB
testcase_08 AC 70 ms
76,452 KB
testcase_09 AC 66 ms
76,756 KB
testcase_10 AC 65 ms
76,208 KB
testcase_11 AC 65 ms
76,120 KB
testcase_12 AC 65 ms
76,844 KB
testcase_13 AC 71 ms
77,180 KB
testcase_14 AC 67 ms
75,948 KB
testcase_15 AC 66 ms
75,508 KB
testcase_16 AC 65 ms
76,044 KB
testcase_17 AC 64 ms
75,764 KB
testcase_18 AC 69 ms
77,252 KB
testcase_19 AC 71 ms
77,380 KB
testcase_20 AC 65 ms
77,200 KB
testcase_21 AC 68 ms
77,000 KB
testcase_22 AC 67 ms
77,332 KB
testcase_23 AC 61 ms
71,328 KB
testcase_24 AC 64 ms
71,192 KB
testcase_25 AC 64 ms
71,156 KB
testcase_26 AC 62 ms
71,060 KB
testcase_27 AC 65 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, a, b = map(int, input().split())
mod = 998244353

fact = [1] * (n + 1)
for i in range(2, n + 1):
    fact[i] = fact[i - 1] * i % mod
ans = fact[n]
if a != b:
    ans -= (2 * fact[n - 1] - fact[n - 2]) % mod
else:
    ans -= 2 * fact[n - 1] % mod
ans %= mod
print(ans)
0