The Amazing Race 1
Problem contributed by @celonymire
A new season of The Amazing Race began, and selected participants can earn luxurious vacations while solving puzzles around the world... Will you cross the final line and earn the ultimate prize?
- The Amazing Race Productions
This is an interactive problem.
Sam has passed the audition phase and is officially competing in the race. The production team gave the green light and the race has officially started! After following their initial clue, they encounter a man that withholds their next clue unless they solve his puzzle! With Sam being a puzzle solver, he steps up to the challenge and interacts with the mysterious man...
The man has a secret number and you have to guess it with only one attempt. Before you finalize your answer, you can ask him a number and he will answer if divides into . Due to the production timeline, you can only ask him times! Otherwise, the show gets delayed and you may risk automatic elimination.
The final answer does not count towards the number of times you ask him!
Task
Implement the function solve(man) that finds the secret number using the provided API.
manis an object of typeMysteriousMan, which is a namespace that provides the APIs toaskandanswer.- You will be using the provided API instead of communicating via standard input and output.
Provided API
man.ask(Y)
- Returns
trueif divides , otherwisefalse. - You can call this function at most times.
man.answer(Y)
- Submit your guess .
- You can only call this function once.
- This call does not count towards the query limit.
Constraints
- Number of times you can call
ask(y)is atmost
Running custom tests...