Woburn Challenge 2015-16 Round 4 - Junior Division
Problem 1: Telling Time
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 ≤ G ≤ 8000) 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 ≤ N ≤ 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 Fi (500 ≤ Fi ≤ 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!
The first line of input consists of two space-separated integers N and G.
The next N lines each consist of a single integer Fi, for i = 1..N.
Output a single integer – the number of watches which are able to break the glass.
4 2000 6000 1000 2000 20001
Point Value: 3
Time Limit: 7.00s
Memory Limit: 16M
Added: Apr 08, 2016
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3