#abc267h. Ex - Odd Sum
Ex - Odd Sum
Score : points
问题描述
给定一个长度为 的序列 。
要求计算从 中选择奇数个元素,使得所选元素之和等于 的方法数量,结果对 取模。
如果存在一个整数 ,使得在一个选择中选取了 ,而在另一个选择中未选取,则认为这两种选择是不同的。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length .
Find the number, modulo , of ways to choose an odd number of elements from so that the sum of the chosen elements equals .
Two choices are said to be different if there exists an integer such that one chooses but the other does not.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
5 6
1 2 3 3 6
Sample Output 1
3
The following choices satisfy the condition:
- Choosing , , and .
- Choosing , , and .
- Choosing .
Choosing and does not satisfy the condition because, although the sum is , the number of chosen elements is not odd.
Sample Input 2
10 23
1 2 3 4 5 6 7 8 9 10
Sample Output 2
18
update @ 2024/3/10 11:17:29