結果

問題 No.2682 Visible Divisible
ユーザー kotatsugame
提出日時 2024-03-20 21:09:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 64,568 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 06:54:52
合計ジャッジ時間 3,927 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
using namespace std;
long gcd(long a,long b)
{
	while(b)
	{
		long t=a%b;
		a=b;
		b=t;
	}
	return a;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	long K;
	cin>>N>>K;
	long T=1;
	for(int i=0;i<N;i++)
	{
		long A;cin>>A;
		A=gcd(K,A);
		T=T/gcd(T,A)*A;
	}
	cout<<(K==T?"Yes":"No")<<endl;
}
0