結果

問題 No.2682 Visible Divisible
ユーザー kotatsugamekotatsugame
提出日時 2024-03-20 21:09:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 63,896 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-20 21:09:21
合計ジャッジ時間 4,765 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
6,548 KB
testcase_01 AC 161 ms
6,548 KB
testcase_02 AC 169 ms
6,548 KB
testcase_03 AC 165 ms
6,548 KB
testcase_04 AC 172 ms
6,548 KB
testcase_05 AC 165 ms
6,548 KB
testcase_06 AC 173 ms
6,548 KB
testcase_07 AC 155 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 3 ms
6,548 KB
testcase_11 AC 156 ms
6,548 KB
testcase_12 AC 157 ms
6,548 KB
testcase_13 AC 156 ms
6,548 KB
testcase_14 AC 155 ms
6,548 KB
testcase_15 AC 152 ms
6,548 KB
testcase_16 AC 153 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

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