WAWAWAWAWA
查看原帖
WAWAWAWAWA
295543
beauty_son_whm楼主2021/7/31 18:24
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;
}
int a[1000005];
int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}
signed main(){
	int n,k;
	n=read(),k=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
	}
	for(int i=2;i<=n;i++){
		int temp=gcd(a[i],a[i-1]);
		a[i]=a[i]/temp*a[i-1];
	}
	if(a[n]%k==0){
		cout<<"Yes";
	}
	else cout<<"No";
	return 0;
}
2021/7/31 18:24
加载中...