結果
問題 |
No.2682 Visible Divisible
|
ユーザー |
![]() |
提出日時 | 2024-03-20 22:12:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 1,992 ms |
コンパイル使用メモリ | 195,316 KB |
最終ジャッジ日時 | 2025-02-20 09:18:20 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; // ユークリッドの互除法 long long gcd(long long a, long long b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { long long n, k; cin >> n >> k; vector<long long> a(n); for (auto &in : a) { cin >> in; } long long aGcd = a[0]; for (int i = 1; i < n; i++) { aGcd = gcd(aGcd, a[i]); } for (auto &elem : a) { elem /= aGcd; } bool ans = true; for (auto elem : a) { if(k % elem == 0) { k /= elem; } } if (k == 1) { cout << "Yes" << endl; } else { cout << "No" << endl; } }