AtCoder Beginner Contest 266
翻译中…
Problem Statement
翻译中…
You are given integers $R$, $G$, $B$, and $K$. How many strings $S$ consisting of R, G, and B satisfy all of the conditions below? Find the count modulo $998244353$.
翻译中…
- The number of occurrences of
R,G, andBin$S$are$R$,$G$, and$B$, respectively. - The number of occurrences of
RGas (contiguous) substrings in$S$is$K$.
翻译中…
Constraints
翻译中…
$1 \leq R,G,B\leq 10^6$$0 \leq K \leq \mathrm{min}(R,G)$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
R G B K
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
2 1 1 1
Output #1
6
The following six strings satisfy the conditions.
- `RRGB`
- `RGRB`
- `RGBR`
- `RBRG`
- `BRRG`
- `BRGR`
Input #2
1000000 1000000 1000000 1000000
Output #2
80957240
Find the count modulo $998244353$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。