题意:已知n个数的模后的结果,求另外一个数模的结果。
题解:中国剩余定理的入门题。
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
int n,m;
while(scanf(" %d %d",&n,&m)==2){
LL ret=1;
for(int i=0;i<n;i++){
int x;
scanf(" %d",&x);
ret = ret/__gcd(x+0ll,ret)*x;
ret = __gcd(m+0ll,ret);
}
if(ret==m){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
}
/*
3 0 10 17 15 2
*/