CF687B.Remainders Game
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Today Pari and Arya are playing a game called Remainders.
Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value
. There are n ancient numbers _c_1, _c_2, ..., c__n and Pari has to tell Arya
if Arya wants. Given k and the ancient values, tell us if Arya has a winning strategy independent of value of x or not. Formally, is it true that Arya can understand the value
for any positive integer x?
Note, that
means the remainder of x after dividing it by y.
今天,帕丽(Pari)和阿莉亚(Arya)正在玩一个名为“余数”的游戏。
帕丽选择两个正整数 x 和 k,并将 k 告知阿莉亚,但不告诉 x。阿莉亚需要求出值 xmodk。此外,存在 n 个古老数字 c1,c2,…,cn,若阿莉亚要求,帕丽需告知她 xmodci(对任意 i)。已知 k 及这些古老数值,请判断:阿莉亚是否存在一种与 x 的具体取值无关的必胜策略?换言之,对于任意正整数 x,阿莉亚是否总能确定 xmodk 的值?
注意:xmody 表示 x 除以 y 后所得的余数。
输入格式
The first line of the input contains two integers n and k (1 ≤ n, k ≤ 1 000 000) — the number of ancient integers and value k that is chosen by Pari.
The second line contains n integers _c_1, _c_2, ..., c__n (1 ≤ c__i ≤ 1 000 000).
输入的第一行包含两个整数 n 和 k(1≤n,k≤1000000)—— 分别表示古代整数的个数以及 Pari 所选定的值 k。
第二行包含 n 个整数 c1,c2,…,cn(1≤ci≤1000000)。
输出格式
Print "Yes" (without quotes) if Arya has a winning strategy independent of value of x, or "No" (without quotes) otherwise.
如果阿雅拥有一个与 x 的值无关的必胜策略,则输出“Yes”(不带引号);否则输出“No”(不带引号)。
输入输出样例
输入#1
4 5 2 3 5 12
输出#1
Yes
输入#2
2 7 2 3
输出#2
No
说明/提示
In the first sample, Arya can understand
because 5 is one of the ancient numbers.
In the second sample, Arya can't be sure what
is. For example 1 and 7 have the same remainders after dividing by 2 and 3, but they differ in remainders after dividing by 7.
在第一个样例中,Arya 能够理解
,因为 5 是某个古老数字。
在第二个样例中,Arya 无法确定
的值。例如,1 和 7 在分别除以 2 和 3 后具有相同的余数,但它们在除以 7 后的余数不同。
输入解题思路,AI测评打分。不知道怎么写?