102356: [AtCoder]ABC235 G - Gardens
Description
Score : $600$ points
Problem Statement
Takahashi has $A$ apple seedlings, $B$ banana seedlings, and $C$ cherry seedlings. Seedlings of the same kind cannot be distinguished.
He will plant these seedlings in his $N$ gardens so that all of the following conditions are satisfied.
- At least one seedling must be planted in every garden.
- It is not allowed to plant two or more seedlings of the same kind in the same garden.
- It is not necessary to plant all seedlings he has.
How many ways are there to plant seedlings to satisfy the conditions? Find the count modulo $998244353$.
Two ways are distinguished when there is a garden with different sets of seedlings planted in these two ways.
Constraints
- $1 \leq N \leq 5 \times 10^6$
- $0 \leq A \leq N$
- $0 \leq B \leq N$
- $0 \leq C \leq N$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
$N$ $A$ $B$ $C$
Output
Print the answer.
Sample Input 1
2 2 1 1
Sample Output 1
21
As illustrated below, there are $21$ ways to plant seedlings to satisfy the conditions.
(The two frames arranged vertically are the gardens. $A, B, C$ stand for apple, banana, cherry, respectively.)
Sample Input 2
2 0 0 0
Sample Output 2
0
There may be no way to plant seedlings to satisfy the conditions.
Sample Input 3
2 0 2 2
Sample Output 3
9
Sample Input 4
100 12 34 56
Sample Output 4
769445780
Sample Input 5
5000000 2521993 2967363 3802088
Sample Output 5
264705492
Input
题意翻译
有三种不同颜色的球,分别有 $A,B,C$ 个。(相同颜色的球之间不区分) 将球放入 $N$ 个不同的盒子中,要求: - 每个盒子至少放了一个球 - 每个盒子不能存在两个相同颜色的球 - 可以不放完所有的球 求放置方案数对 $998244353$ 取模的结果。Output
问题描述
高桥有$A$棵苹果树苗、$B$棵香蕉树苗和$C$棵樱桃树苗。同种类的树苗无法区分。
他要在自己的$N$个花园里种植这些树苗,使所有下列条件都得到满足。
- 每个花园至少种植一棵树苗。
- 不允许在同一个花园里种植两棵或两棵以上的同种类树苗。
- 不需要种植他拥有的所有树苗。
满足条件的种植方法有多少种?求答案模$998244353$的结果。
当有两种种植方法使得有一个花园种植的树苗种类集合不同时,这两种种植方法被认为是不同的。
约束条件
- $1 \leq N \leq 5 \times 10^6$
- $0 \leq A \leq N$
- $0 \leq B \leq N$
- $0 \leq C \leq N$
- 输入中的所有值都是整数。
输入
输入通过标准输入给出,格式如下:
$N$ $A$ $B$ $C$
输出
打印答案。
样例输入 1
2 2 1 1
样例输出 1
21
如图所示,有$21$种满足条件的种植方法。
(竖向排列的两个框架代表花园。$A, B, C$分别代表苹果、香蕉和樱桃。)
样例输入 2
2 0 0 0
样例输出 2
0
可能没有满足条件的种植方法。
样例输入 3
2 0 2 2
样例输出 3
9
样例输入 4
100 12 34 56
样例输出 4
769445780
样例输入 5
5000000 2521993 2967363 3802088
样例输出 5
264705492