#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
using namespace std;
int a,m;
bool flag[100010]={0};
int main()
{
while(scanf("%d%d",&a,&m)!=EOF)
{
int f=1;
flag[a]=1;
while(f==1)
{
a=(a+a%m)%m;
if(a==0) break;
else
{
if(flag[a]==0)
flag[a]=1;
else
f=0;
}
}
if(f)
printf("Yes");
else
printf("No");
}
return 0;
}
时间: 2024-10-13 02:15:30