Codeforces Round 729 (Div. 2) |
---|
Finished |
There is an infinite set generated as follows:
For example, when $$$a=3$$$ and $$$b=6$$$, the five smallest elements of the set are:
Given positive integers $$$a$$$, $$$b$$$, $$$n$$$, determine if $$$n$$$ is in this set.
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1\leq t\leq 10^5$$$) — the number of test cases. The description of the test cases follows.
The only line describing each test case contains three integers $$$n$$$, $$$a$$$, $$$b$$$ ($$$1\leq n,a,b\leq 10^9$$$) separated by a single space.
For each test case, print "Yes" if $$$n$$$ is in this set, and "No" otherwise. You can print each letter in any case.
5 24 3 5 10 3 6 2345 1 4 19260817 394 485 19260817 233 264
Yes No Yes No Yes
In the first test case, $$$24$$$ is generated as follows:
Thus we can see $$$24$$$ is in this set.
The five smallest elements of the set in the second test case is described in statements. We can see that $$$10$$$ isn't among them.
Name |
---|