#P16285. [蓝桥杯 2026 省 Python A 组] 可选数

    ID: 18300 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 显示难度提高 上传者: 标签>数学数论素数判断,质数,筛法2026蓝桥杯省赛

[蓝桥杯 2026 省 Python A 组] 可选数

Problem Description

Given NN positive integers A1,A2,…,ANA_1, A_2, \dots, A_N and a target integer KK.

If a positive integer XX is a common multiple of A1,A2,…,ANA_1, A_2, \dots, A_N, then we call XX an optional number.

Now, you need to find the smallest positive integer PP such that for any optional number XX, lcm(X,P)\text{lcm}(X, P) (the least common multiple of XX and PP) is divisible by KK.

Input Format

The first line contains two integers NN and KK.

The second line contains NN integers A1,A2,…,ANA_1, A_2, \dots, A_N.

Output Format

Output one integer, representing the smallest positive integer PP that satisfies the condition.

3 12
6 4 9
1
2 10
4 6
5

Hint

Constraints

For 20%20\% of the testdata, 1≤N≤201 \leq N \leq 20, 1≤K,Ai≤1061 \leq K, A_i \leq 10^6.

For all testdata, 1≤N≤2×1051 \leq N \leq 2 \times 10^5, 1≤K,Ai≤10181 \leq K, A_i \leq 10^{18}.

Translated by ChatGPT 5