結果

問題 No.2299 Antitypoglycemia
ユーザー ShirotsumeShirotsume
提出日時 2023-03-02 21:39:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 61,056 KB
最終ジャッジ日時 2023-10-18 05:38:01
合計ジャッジ時間 3,033 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,360 KB
testcase_01 AC 43 ms
53,360 KB
testcase_02 AC 42 ms
53,360 KB
testcase_03 AC 47 ms
60,524 KB
testcase_04 AC 47 ms
60,540 KB
testcase_05 AC 46 ms
60,116 KB
testcase_06 AC 46 ms
60,528 KB
testcase_07 AC 45 ms
59,716 KB
testcase_08 AC 47 ms
60,452 KB
testcase_09 AC 46 ms
60,556 KB
testcase_10 AC 46 ms
59,880 KB
testcase_11 AC 46 ms
59,920 KB
testcase_12 AC 46 ms
60,640 KB
testcase_13 AC 47 ms
60,988 KB
testcase_14 AC 44 ms
59,624 KB
testcase_15 AC 44 ms
59,488 KB
testcase_16 AC 45 ms
59,964 KB
testcase_17 AC 46 ms
59,760 KB
testcase_18 AC 47 ms
61,056 KB
testcase_19 AC 47 ms
61,056 KB
testcase_20 AC 46 ms
61,056 KB
testcase_21 AC 47 ms
61,056 KB
testcase_22 AC 48 ms
61,056 KB
testcase_23 AC 41 ms
53,360 KB
testcase_24 AC 41 ms
53,360 KB
testcase_25 AC 42 ms
53,360 KB
testcase_26 AC 42 ms
53,360 KB
testcase_27 AC 42 ms
53,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, a, b = mi()

fact = [1] * (n + 1)

for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i
    fact[i] %= mod

if a == b:
    ans = (fact[n] - 2 * fact[n - 1]) % mod
else:
    ans = (fact[n] - 2 * fact[n - 1] + fact[n - 2]) % mod

print(ans)
0