WC '15 Contest 4 J1 - Telling Time

View as PDF

Submit solution

Points: 3
Time limit: 3.0s
Memory limit: 16M

Problem type
Woburn Challenge 2015-16 Round 4 - Junior Division

James Bond is preparing to embark on a particularly dangerous mission – catching ruthless Canadian ice wine smugglers. He'll be attending a secret (but elegant) wine tasting party at the smugglers' hideout, with the intention of causing a huge distraction and sneaking further into their lair. If only there were a way to suddenly disrupt the wine tasting process for all of the guests...

Fortunately for Bond, Q has an idea. According to his research, the glass which the wine glasses are made of has a resonance frequency of G (800 \le G \le 8\,000) Hz. If a loud noise were to be emitted in the room, with a frequency which is an exact multiple of the glass's resonance frequency, the wine glasses could be made to all shatter at once, giving Bond just the kind of distraction he'll need!

Q has developed N (1 \le N \le 100) fancy watches for this mission. Aside from helping Bond look the part of a rich wine collector (and be able to tell the time), the watches have powerful auditory emitters embedded within them! The i-th watch can emit noise at a frequency of F_{i} (500 \le F_{i} \le 100\,000) Hz.

Though all N watches can keep time accurately, only the ones with frequencies which are exact multiples of G Hz will be of use to Bond for this mission. Please help Q count how many of his watches he could potentially give to Bond!

Input Specification

The first line of input consists of two space-separated integers N and G.
The next N lines each consist of a single integer F_{i}, for i = 1
\ldots N.

Output Specification

Output a single integer – the number of watches which are able to break the glass.

Sample Input

4 2000

Sample Output



There are no comments at the moment.