Poke Dice solution codechef

Poke Dice solution codechef

There are NN pokemon in a class, each pokemon is given 2 fair dice. One of the dice contains : 2, 7, 12, 17, 22 & 27 and the other dice contains : 3, 8, 13, 18, 23 & 28.

The pokemon are asked to throw both the dice MM-times and sum up whatever comes each time on both the dice and add all the outcomes.

You ask each pokemon the sum of all the outcomes but strangely some of them are lying. Find the number of honest answers.

Input: Poke Dice solution codechef

The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.

The first line of each test case contains a single integer NN.

The second line contains a single integer MM.

The third line contains NN space-separated integers A1,A2...,ANA1,A2…,AN, the sum of all the outcomes of NN pokemon.

Output: Poke Dice solution codechef

For each test case, print a single integer, the number of honest pokemon.

Constraints Poke Dice solution codechef

  • 1T1021≤T≤102
  • 1N1041≤N≤104
  • 1M10101≤M≤1010

Sample Input: Poke Dice solution codechef

1
2
1
15 32

Sample Output:

1

EXPLANATION:

We can only get 15 from the two dice. To get 15 -> Dice1: 7 and Dice2: 8.

Poke Dice solution codecheffreshersonlinefreshersonlinefreshersonline

Leave a Comment