結果

問題 No.2682 Visible Divisible
ユーザー inkyamaninkyaman
提出日時 2024-03-22 01:19:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 1,270 ms
コンパイル使用メモリ 118,960 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-22 01:19:27
合計ジャッジ時間 5,592 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
6,676 KB
testcase_01 AC 193 ms
6,676 KB
testcase_02 AC 193 ms
6,676 KB
testcase_03 AC 188 ms
6,676 KB
testcase_04 AC 193 ms
6,676 KB
testcase_05 AC 189 ms
6,676 KB
testcase_06 AC 188 ms
6,676 KB
testcase_07 AC 194 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 186 ms
6,676 KB
testcase_12 AC 193 ms
6,676 KB
testcase_13 AC 182 ms
6,676 KB
testcase_14 AC 189 ms
6,676 KB
testcase_15 AC 188 ms
6,676 KB
testcase_16 AC 192 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;

int N;
ll K;

int main() {

    cin >> N >> K;
    vector<ll> g(N);
    for(int i = 0; i < N; ++i) {
        ll a; cin >> a;
        g[i] = gcd(a,K);
    }

    ll ans = 1;
    for(int i = 0; i < N; ++i) ans = ans/gcd(ans,g[i])*g[i];
    
    cout << (ans == K ? "Yes" : "No") << endl;

}
0