結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2020-10-09 22:12:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 793 bytes |
コンパイル時間 | 931 ms |
コンパイル使用メモリ | 97,076 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-07-20 12:01:33 |
合計ジャッジ時間 | 3,596 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 48 |
ソースコード
#include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #include<vector> #include<string.h> #include<math.h> #include<map> #include<iomanip> #include<queue> using namespace std; using ll = long long; using ull = unsigned long long; ll mod = 1e9 + 7; long long gcd(long long a,long long b){ long long x=max(a,b),y=min(a,b); if(x%y==0)return y; else return gcd(y,x%y); } long long lcm(long long a,long long b){ return (a/gcd(a,b))*b; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n , h; cin >> n >> h; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } sort(a.begin() , a.end()); for(int i = 0; i < n; i++){ h = h / gcd(h , a[i]); if(h == 1){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }