結果
| 問題 | No.2682 Visible Divisible |
| コンテスト | |
| ユーザー |
Higurashi
|
| 提出日時 | 2024-03-20 22:08:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,181 bytes |
| コンパイル時間 | 10,548 ms |
| コンパイル使用メモリ | 460,188 KB |
| 最終ジャッジ日時 | 2025-02-20 09:15:48 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が10進数で1024桁の浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
// ユークリッドの互除法
Bint gcd(Bint a, Bint b)
{
if (a % b == 0)
{
return b;
}
else
{
return gcd(b, a % b);
}
}
int main()
{
long long n, k;
cin >> n >> k;
vector<Bint> a(n);
for (auto &in : a)
{
cin >> in;
}
Bint aGcd = a[0];
for (int i = 1; i < n; i++)
{
aGcd = gcd(aGcd, a[i]);
}
for (auto &elem : a)
{
elem /= aGcd;
}
Bint aLcm = a[0];
for (int i = 1; i < n; i++)
{
aLcm *= a[i];
}
if (aLcm % k == 0)
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
}
Higurashi