結果

問題 No.1250 汝は倍数なりや?
ユーザー 沙耶花
提出日時 2020-10-09 21:22:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 109 ms / 1,000 ms
コード長 396 bytes
コンパイル時間 1,898 ms
コンパイル使用メモリ 192,832 KB
最終ジャッジ日時 2025-01-15 03:48:50
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 2000000001


int main(){	

	int N;
	cin>>N;
	
	long long H;
	cin>>H;
	
	rep(i,N){
		long long a;
		cin>>a;
		a = abs(a);
		long long g = gcd(a,H);
		if(a==0){
			H = 1;
			continue;
		}
		H /= g;
	}
	
	if(H==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
		

    return 0;
}
0