No.2299 Antitypoglycemia
タグ : / 解いたユーザー数 188
作問者 :
yassu0320
Problem Statement
There is a sequence $P = (P_1, P_2, \dots, P_N)$ that is a permutation of $(1, 2, \dots, N)$.
You have forgotten $P$, but you remember only that the first term $P_1$ was not $A$ and the last term $P_N$ was not $B$.
Assuming this memory is correct, find the number of possible sequences $P$, modulo $998244353$.
Constraints
- All input values are integers.
- $2 \leq N \leq 2 \times 10^5$
- $1 \leq A, B \leq N$
Input
The input is given from standard input in the following format.
$N$ $A$ $B$
Output
Output the number of possible sequences $P$, modulo $998244353$.
Sample
Sample 1
Input
3 1 2
Output
3
The permutations of $(1, 2, 3)$ whose first term is not $1$ and whose last term is not $2$ are the following $3$: $(2, 1, 3)$, $(2, 3, 1)$, and $(3, 2, 1)$.
Sample 2
Input
3 1 1
Output
2
The permutations of $(1, 2, 3)$ whose first term is not $1$ and whose last term is not $1$ are the following $2$: $(2, 1, 3)$ and $(3, 1, 2)$.
Sample 3
Input
100 75 43
Output
292028703
Do not forget to output the result modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。