|
||||||||||
Euclidean AlgorithmTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 685 Accepted Submission(s): 213 Problem Description wr recently learned the Euclidean algorithm to solve the greatest common divisor,then he realized that the algorithm can also be able to solve the least common multiple.In order to train the skill of code,he find a number p(1<=p<=2^25)and a number q(1<=q<=2^25) then he got n=p*q,he calculated a1=¡Ægcd(i, n) 1<=i <=n and a2= ¡Ælcm(i, n) 1<=i <=n,he wants to know if a2-a1 is the multiple of c(1<=c<=10^9) Input The first line contains the number of scenarios. Every scenario consists of a single line containing two integers n and c separated by a space. Output for every scenario print a single line contain "yes" or "no" if the difference is the multiple of c print "yes",otherwise print "no" Sample Input
Sample Output
Source | ||||||||||
|