51,733
社区成员
发帖
与我相关
我的任务
分享
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while (t-->0){
long a=sc.nextLong();
long b=sc.nextLong();
long c=sc.nextLong();
long k=sc.nextLong();
long res=gcd(1-k,gcd(a,b));
if (c%res==0) System.out.println("Yes");
else System.out.println("No");
}
}
static long gcd(long a,long b){
return b==0?a:gcd(b,a%b);
}
}