Count Modulo 2
Time limit3.5sMemory limit1024 MB
Given N and a set A, count the length-N sequences of values from A that sum to S, modulo 2, with N and S up to 10^18.
- Level
Medium7 of 10
- Topics
- Math, Dynamic programming, Number theory
- Solved
- No attempts yet
Problem
You are given distinct nonnegative integers . Count the number of sequences of nonnegative integers that satisfy all of the following conditions, modulo 2.
- For each (), there exists an integer such that .
There are tests in one input file.
Input
Input is given from standard input in the following format:
The description of each test is given in the following format, one test after another.
Output
For each test, print the count modulo 2.
Constraints
- All values in input are integers.
Hint
In the first test, there are a total of 51 sequences that satisfy the conditions.