結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2020-10-09 22:26:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 787 bytes |
コンパイル時間 | 779 ms |
コンパイル使用メモリ | 94,796 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-20 12:34:33 |
合計ジャッジ時間 | 3,490 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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]; } int g = a[0]; for(int i = 1; i < n; i++){ g = gcd(g , a[i]); } if(g % h == 0 || h % g == 0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }