You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
366 B

#include<bits/stdc++.h>
using namespace std;
int main(void) {
long long a, b,i;
scanf("%lld%lld", &a, &b);
int success=1;
while(b%2==0) {
if(a%2!=0) {
success=0;
}
b/=2;
}
for(i=3; i<=sqrt(b); i+=2) {
if(b%i==0) {
if(a%i!=0) {
success=0;
}
b/=i;
i-=2;
}
}
if (success)
printf("Yes\n");
else
printf("No\n");
return 0;
}