結果

問題 No.2682 Visible Divisible
ユーザー SnowBeenDidingSnowBeenDiding
提出日時 2024-03-20 21:39:46
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 6,432 ms
コンパイル使用メモリ 308,372 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 21:39:58
合計ジャッジ時間 11,490 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 249 ms
6,676 KB
testcase_01 AC 249 ms
6,676 KB
testcase_02 AC 257 ms
6,676 KB
testcase_03 AC 254 ms
6,676 KB
testcase_04 AC 243 ms
6,676 KB
testcase_05 AC 269 ms
6,676 KB
testcase_06 AC 242 ms
6,676 KB
testcase_07 AC 241 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 251 ms
6,676 KB
testcase_12 AC 258 ms
6,676 KB
testcase_13 AC 244 ms
6,676 KB
testcase_14 AC 250 ms
6,676 KB
testcase_15 AC 247 ms
6,676 KB
testcase_16 AC 240 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace std;
using namespace atcoder;

typedef long long ll;

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

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

int main() {
    int n;
    ll ink;
    cin >> n >> ink;
    __int128 k = ink;
    __int128 lc = 1;
    rep(i, 0, n) {
        ll inx;
        cin >> inx;
        __int128 x = inx;
        lc = lcm(lc, x);
        lc = gcd(lc, k);
    }
    if (k == lc)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
0