AT_abc458_e.Count 123
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Find the number, modulo 998244353, of sequences A=(a1,⋯,aX1+X2+X3) of length X1+X2+X3 that satisfy all of the following conditions.
- A contains exactly X1 copies of 1, exactly X2 copies of 2, and exactly X3 copies of 3.
- The absolute difference between adjacent elements is at most 1. That is, for every integer i satisfying 1≤i≤X1+X2+X3−1, we have ∣ai+1−ai∣≤1.
求满足以下所有条件的序列 A=(a1,⋯,aX1+X2+X3)(长度为 X1+X2+X3)的个数,答案对 998244353 取模。
- A 中恰好包含 X1 个 1、恰好包含 X2 个 2、恰好包含 X3 个 3;
- 相邻元素的绝对差值至多为 1。即,对每个满足 1≤i≤X1+X2+X3−1 的整数 i,均有 ∣ai+1−ai∣≤1。
输入格式
The input is given from Standard Input in the following format:
X1 X2 X3
输入从标准输入中按以下格式给出:
X1 X2 X3
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
2 2 1
输出#1
9
输入#2
5 3 4
输出#2
204
输入#3
998244 998353 998107
输出#3
701926019
说明/提示
Sample 1 Explanation:
The sequences satisfying the conditions are the following nine:
- (1,1,2,2,3)
- (1,1,2,3,2)
- (1,2,1,2,3)
- (1,2,3,2,1)
- (2,1,1,2,3)
- (2,3,2,1,1)
- (3,2,1,1,2)
- (3,2,1,2,1)
- (3,2,2,1,1)
Constraints
- 1≤X1,X2,X3≤106
- All input values are integers.
样例 1 解释:
满足条件的序列共有以下九个:
- (1,1,2,2,3)
- (1,1,2,3,2)
- (1,2,1,2,3)
- (1,2,3,2,1)
- (2,1,1,2,3)
- (2,3,2,1,1)
- (3,2,1,1,2)
- (3,2,1,2,1)
- (3,2,2,1,1)
限制条件
- 1≤X1,X2,X3≤106
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?