結果
| 問題 | No.1250 汝は倍数なりや? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-06-28 11:17:44 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 150 ms / 1,000 ms | 
| コード長 | 682 bytes | 
| コンパイル時間 | 1,726 ms | 
| コンパイル使用メモリ | 114,616 KB | 
| 最終ジャッジ日時 | 2025-01-22 14:47:28 | 
| ジャッジサーバーID (参考情報) | judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 49 | 
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
    int32_t n, h;
    cin >> n >> h;
    vector<int32_t> as(n);
    bool f = false;
    for (auto &&a : as) {
        cin >> a;
        a = abs(a);
        f = f || a == 0;
    }
    if (f) {
        cout << "YES" << endl;
        return 0;
    }
    for (auto a : as) {
        h /= gcd(h, a);
    }
    cout << (h == 1 ? "YES" : "NO") << endl;
    return 0;
}
            
            
            
        