#P7789. Tokitsukaze and Multiple
Tokitsukaze and Multiple
Tokitsukaze and Multiple
Problem Description
Tokitsukaze has a sequence of length , denoted by . Tokitsukaze can merge two consecutive elements of as many times as she wants. After each operation, a new element that equals to the sum of the two old elements will replace them, and thus the length of will be reduced by . Tokitsukaze wants to know the maximum possible number of elements that are multiples of she can get after doing some operations (or doing nothing) on the sequence .
Input
There are several test cases. The first line contains an integer , denoting the number of test cases. Then follow all the test cases. For each test case, the first line contains two integers and , denoting the length of the sequence and the special number, respectively. The second line contains integers, where the -th integer is the -th element of . It is guaranteed that the sum of in all test cases is no larger than .
Output
For each test case, output in one line the maximum possible number of elements that are multiples of after doing some operations.
Sample Input
2
5 3
2 1 3 2 1
3 1
123 456 789
Sample Output
3
3
Source
2020 Multi-University Training Contest 3