結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2021-04-23 20:02:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 1,000 ms |
コード長 | 369 bytes |
コンパイル時間 | 822 ms |
コンパイル使用メモリ | 70,164 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-04 07:16:26 |
合計ジャッジ時間 | 4,414 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
#include<iostream> #include<algorithm> #include<cmath> using namespace std; using ll = long long; ll gcd(ll a, ll b) { if (b==0) return a; return gcd(b, a%b); } int main() { int n; ll h; cin >> n >> h; for(int i=0; i<n; ++i) { ll a; cin >> a; h /= gcd(abs(a), h); } if (h==1) cout << "YES\n"; else cout << "NO\n"; }