結果

問題 No.2682 Visible Divisible
ユーザー GOTKAKOGOTKAKO
提出日時 2024-03-20 21:23:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 2,116 ms
コンパイル使用メモリ 201,912 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 21:23:30
合計ジャッジ時間 4,724 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
6,676 KB
testcase_01 AC 88 ms
6,676 KB
testcase_02 AC 94 ms
6,676 KB
testcase_03 AC 88 ms
6,676 KB
testcase_04 AC 98 ms
6,676 KB
testcase_05 AC 94 ms
6,676 KB
testcase_06 AC 88 ms
6,676 KB
testcase_07 AC 83 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 89 ms
6,676 KB
testcase_12 AC 95 ms
6,676 KB
testcase_13 AC 86 ms
6,676 KB
testcase_14 AC 92 ms
6,676 KB
testcase_15 AC 92 ms
6,676 KB
testcase_16 AC 96 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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