Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden on 2014-03-02 19:51:57 by Francky

IOPC_14O - Infinite GP in Infinite GP

no tags 

Consider an infinite geometric sequence S={1, 12, 14, 18 … }.


For given fraction pq, check whether one can select an infinite geometric sequence R, such that R ⊆ S and Summation of all elements in R is p/q
.

Input Format

First line contains an integer T, representing the number of test cases. The next T lines,each contain two space separated integers, p and q.

Output Format

The output should contain T lines, one for each test case. If there exists such a sequence satisfying the given constraint, print "YES" (without quotes), else print "NO".

Constraints

  • T ≤ 50000
  • 1 ≤ p,q ≤ 1e9

 

Sample Input :

2

3 1

1 3

Sample Output :

NO

YES

Explanation :

For 1st test case, there cannot exist any series with sum as 3, since maximum sum possible is 2.

For 2nd test case, the series beginning with 14 and geometric factor as 14, has sum 13


Added by:devu
Date:2014-03-02
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Setter: Rachit Nimavat | Tester : Devendra Agarwal | Writter : Vijay Keswani