Game of Dice.

0

0 votes
Basic Math, Number
Problem

There are N student in a class each of them are given two fair dice,   first dice contains 1,4,7,10,13,16  whereas other dice contains, 2,5,8,11,14,17.  All student are asked to roll thier both dices M number of times.

Let define sumi for a student as sum of number on both the dice on thier iith throw. 

Now you asked each student at end of thier final throw Mi=1sumi (that is total sum of all sumi over all M throws). Some of students are lying you have to find the number of honest students.

Input format

  • First line will contain integers N,M where N denoting the number of students and M denotes the total number of throw.
  • Second line will contain N separated integers A1,A2,...Ai,..,ANwhere   Ai  denotes the total sum of all M throws for ith student that he told to you.

Output format

  • Print a single integer that is total number honest students.

Constraints

  • 1N105
  • 1M106
  • 1Ai109
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

First student is honest as he can get 1 on first and 2 on second dice on first throw and similarly on second  throw as well so total sum of all number on both dices on 2 throws will be (1+2)+(1+2) =6.

Second student is lying as he cannot get sum of 10 in 2 throws.

For third student  he can get 1 on first dice and 5 on second dice on first throw whereas on  second  throw he can get 4 on first dice and 5 on second dice which will sum up to (1+5)+(4+5) =15 so he is also honest.

So total number of honest student is 2.

Editor Image

?