题目链接:传送门
题意:给你A,B,C,问:(n×A)%B==C这个式子是否成立。
可能说得不对。以后会更正的。
(A*x)%B==C
(A*x+B*y)%B==C %B
A*x+B*y=C (x,y 存在某个值使他成立)
证明A和B是否能找到一个x和y构成C
这个就是欧几里德,C%gcd(A,B)==0就证明有解。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(c%__gcd(a,b)==0){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}