結果

問題 No.2682 Visible Divisible
ユーザー daiota
提出日時 2024-03-20 23:19:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 1,557 ms
コンパイル使用メモリ 172,076 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-30 09:25:17
合計ジャッジ時間 4,727 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)




ll gcd(ll a,ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}


ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}



int main(){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
    int i,j,k;


    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    for(i=0;i<N;i++){
    	cin >> A[i];
    	A[i]%=K;
    }

    sort(A.begin(),A.end());

    ll x=1;
    for(i=0;i<N;i++){
    	x=lcm(x,A[i]);
    	x%=K;
    }



    if(x%K==0) cout << "Yes" << endl;
    else cout << "No" << endl;




	return 0;

}
0