#include<stdio.h> int main() { int Euclid(int n,int m); int t; scanf("%d",&t); while(t--) { int a,b,n; scanf("%d%d%d",&a,&b,&n); if(n%Euclid(a,b)==0) printf("Yes "); else printf("No "); } return 0; } int Euclid(int n,int m) //欧几里德除法求最大公约数 { int t=n%m; while(t) { n=m; m=t; t=n%m; } return m; }
求最大公约数的过程 反带就会出现 c=sa+tb; c为最大公约数 s t a b 都为整数