結果

問題 No.2682 Visible Divisible
ユーザー otoshigo
提出日時 2024-03-20 21:35:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 75,596 KB
最終ジャッジ日時 2025-02-20 08:50:16
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    ll K;
    cin>>N>>K;
    vector<ll>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    for(int i=0;i<N;i++){
        ll g=gcd(K,A[i]);
        if(g>1){
            for(int j=0;j<N;j++){
                if(A[j]%g==0)A[j]/=g;
            }
            K/=g;
        }
    }
    cout<<(K==1?"Yes":"No")<<"\n";
}
0