#abc220d. D - FG operation
D - FG operation
Score : points
问题描述
我们有一序列包含 个整数的序列,这些整数介于 和 (包括两端)之间:,按照从左到右的顺序排列。
在序列长度缩减为 之前,我们将重复执行以下操作 或 。
- 操作 :删除最左边的两个数(设它们分别为 和 ),然后将 插入到左侧起始位置。
- 操作 :删除最左边的两个数(设它们分别为 和 ),然后将 插入到左侧起始位置。
这里, 表示 除以 的余数。
对于每个 ,回答以下问题:
在我们进行操作的所有可能方式中(共 种),有多少种方式最终使序列的值为 ? 由于答案可能会非常大,请计算结果对 取模。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a sequence of integers between and (inclusive): , arranged from left to right in this order.
Until the length of the sequence becomes , we will repeatedly do the operation or below.
- Operation : delete the leftmost two values (let us call them and ) and then insert to the left end.
- Operation : delete the leftmost two values (let us call them and ) and then insert to the left end.
Here, denotes the remainder when is divided by .
For each , answer the following question.
Among the possible ways in which we do the operations, how many end up with being the final value of the sequence?
Since the answer can be enormous, find it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print ten lines.
The -th line should contain the answer for the case .
Sample Input 1
3
2 7 6
Sample Output 1
1
0
0
0
2
1
0
0
0
0
If we do Operation first and Operation second: the sequence becomes .
If we do Operation first and Operation second: the sequence becomes .
If we do Operation first and Operation second: the sequence becomes .
If we do Operation first and Operation second: the sequence becomes .
Sample Input 2
5
0 1 2 3 4
Sample Output 2
6
0
1
1
4
0
1
1
0
2
update @ 2024/3/10 09:43:33