#abc258h. Ex - Odd Steps
Ex - Odd Steps
Score : points
问题陈述
求满足以下所有条件的序列 的个数,结果对 取模。
- 序列 中的每个项都是一个正的奇数。
- 中各项之和为 。
- 的前缀和中不包含任何 。形式上,如果我们定义对于每个 ,,则对于所有整数 和 (满足 且 ),都有 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Find the number, modulo , of sequences that satisfy all of the following conditions.
- Every term in is a positive odd number.
- The sum of the terms in is .
- The prefix sums of contain none of . Formally, if we define for each , then holds for all integers and such that and .
Constraints
- $1 \leq A_1 \lt A_2 \lt \dots \lt A_N \lt S \leq 10^{18}$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 7
2 4 5
Sample Output 1
3
The following three sequences satisfy the conditions.
Sample Input 2
5 60
10 20 30 40 50
Sample Output 2
37634180
Sample Input 3
10 1000000000000000000
1 2 4 8 16 32 64 128 256 512
Sample Output 3
75326268
update @ 2024/3/10 10:58:41