結果

問題 No.2682 Visible Divisible
ユーザー ゆにぽけゆにぽけ
提出日時 2024-03-20 21:23:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 963 bytes
コンパイル時間 2,522 ms
コンパイル使用メモリ 127,280 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 21:23:15
合計ジャッジ時間 3,049 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
6,676 KB
testcase_01 AC 21 ms
6,676 KB
testcase_02 AC 23 ms
6,676 KB
testcase_03 AC 20 ms
6,676 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 20 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 19 ms
6,676 KB
testcase_14 WA -
testcase_15 AC 20 ms
6,676 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <random>
#include <utility>
#include <functional>
using namespace std;
template<class T = long long>
T gcd(T a,T b)
{
	while(b)
	{
		a %= b;
		swap(a,b);
	}
	return a;
}

template<class T = long long>
T lcm(T a,T b)
{
	return a / gcd<T>(a,b) * b;
}

void Main()
{
	int N;
	long long K;
	cin >> N >> K;
	long long L = 1;
	for(int i = 0;i < N;i++)
	{
		int a;
		cin >> a;
		a = gcd(a,K);
		L = lcm(L,a);
	}
	cout << (L == K ? "Yes\n" : "No\n");
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	/* cin >> tt; */
	while(tt--) Main();
}
0