Decimal Expansion

5

1 votes
Easy
Problem

You are given 2 integers A and B. Find whether the decimal expansion of A/B is terminating or not.

Input format 

The first line of input contains an integer T denoting the number of test cases.

Next T lines contains 2 integers A and B.

Output format

If the decimal expansion is terminating print "YES" else print "NO" in a new line.

Input Constraints

1<=T<=10

0<=A<=109

1<=B<=109

Probelm setter: Harshit Agarwala

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

1/7=0.1428571428571.... Non-Terminating

3/8=0.375,  Terminating

5/3= 1.66666... Non-Terminating

2/100= 0.02 , Terminating

Editor Image

?