Mastermind
I'm thinking of a secret number between 1 and 100. What is it?
Okay, okay, fine. You tell me some number , and I'll tell you whether or not my secret number is divisible by
.
With the clues I give you, try and figure out what my secret number is!
Input
The first line of each test case consists of an integer
, the number of clues you've been given.
The next lines are in the form
X Yes/No
indicating that my secret number is or isn't divisible by
.
For example, 3 Yes
indicates that my secret number is divisible by 3.
Output
For each test case, output the secret number I'm thinking of.
Example
Input
3
12 Yes
8 No
5 Yes
Output
60
At first, any number from 1 to 100 can be my secret number.
After clue #1, my secret number could be 12, 24, 36, 48, 60, 72, 84 or 96.
After clue #2, my secret number could be 12, 36, 60 or 84.
After clue #3, my secret number can only be 60.
Comments