結果
| 問題 | No.1250 汝は倍数なりや? | 
| コンテスト | |
| ユーザー |  ytft | 
| 提出日時 | 2021-05-15 00:02:30 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 107 ms / 1,000 ms | 
| コード長 | 533 bytes | 
| コンパイル時間 | 2,980 ms | 
| コンパイル使用メモリ | 337,212 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-02 06:43:19 | 
| 合計ジャッジ時間 | 6,476 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 49 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mp;
int natural_gcd(int a,int b){
    int m=min(a,b),M=max(a,b);
    int temp;
    while(m>0){
        temp=m;
        m=M%m;
        M=temp;
    }
    return M;
}
int main(){
    int N,H;
    cin>>N>>H;
    for(int i=0;i!=N;++i){
        int A;
        cin>>A;
        if(A==0){
            H=1;
            break;
        }
        H/=natural_gcd(H,abs(A));
    }
    cout<<(H==1?"YES":"NO")<<endl;
}
            
            
            
        