結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    long long N,K; cin >> N >> K;
    long long lcm = 1;
    while(N--){
        long long a; cin >> a;
        long long g = gcd(K,a);
        lcm = lcm/gcd(g,lcm)*g; 
    }
    if(lcm == K) cout << "Yes" << endl;
    else cout << "No" << endl;
}
0