## WC '01 P6 - Mission Impossible 3

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 16M

Problem type
##### Woburn Challenge 2001

Well, as it turns out, James Bond successfully escaped the CBS attack helicopter and was debriefed at IMF headquarters in Langley, VA. Unfortunately, the only information he was able to retrieve was numbers (, , ) that would allow an IMF team to hack into CBS computers to obtain the name of the last Survivor. CBS computers are encrypted using numerical key that is not divisible by either or (note that if it was divisible, it would make cracking it substantially easier). It also turns out that is the maximum number that they could have used for the encryption key.

With only this limited information, the only way to hack into the computer would be to determine the decryption key for each possible encryption key and try each of the decryption keys individually to see if they worked. Now keep in mind that all secure computers are placed in rooms with 50 ft ceilings and aerial access through ventilation ducts, and so the IMF insertion will undoubtedly involve Ethan Hunt hanging upside down from the roof of this room typing on the computer. A man can only hang upside down so long before blood pools in his brain causing loss of consciousness, so he can only try a limited number of decryption keys before he goes unconscious.

The question is this: how many decryption keys can we rule out? i.e. how many positive numbers are divisible by either or (the more keys we can rule out, the fewer keys need to be tried)

#### Input Specification

The first line contains , the number of test cases.

Each of the remaining lines is a test case consisting of the three positive integers , , on a line.

#### Output Specification

For each input, print the number of positive integers less than or equal to that are divisible by or .

#### Sample Input

3
50 3 21
63 6 8
34 8 15

#### Sample Output

16
15
6

## Comments

• commented on Oct. 17, 2021, 5:08 p.m. edited

Since the original data were weak, batches (each worth marks) with test cases were added to replace it.

• commented on June 10, 2021, 1:47 a.m. edited

Bonus:

There are actually cases in this problem (equally weighted), one where the constraints match and another where they match the 'bonus' constraints.