BaoBao has just found a positive integer sequence $a1,a2,…,an$ of length $n$ from his left pocket and another positive integer $b$ from his right pocket. As number 7 is BaoBao’s favorite number, he considers a positive integer $x$ lucky if $x$ is divisible by 7. He now wants to select an integer $a_k$ from the sequence such that $(a_k+b)$ is lucky. Please tell him if it is possible.
There are multiple test cases. The first line of the input is an integer $T$ (about 100), indicating the number of test cases. For each test case:
The first line contains two integers $n$ and $b$ ($1≤n,b≤100$), indicating the length of the sequence and the positive integer in BaoBao’s right pocket.
The second line contains $n$ positive integers $a1,a2,…,an$ ($1≤ai≤100$), indicating the sequence.
For each test case output one line. If there exists an integer $a_k$ such that $a_k∈a1,a2,…,an$ and $(a_k+b)$ is lucky, output “Yes” (without quotes), otherwise output “No” (without quotes).
1 | 4 |
1 | No |
For the first sample test case, as 4 + 7 = 11, 5 + 7 = 12 and 6 + 7 = 13 are all not divisible by 7, the answer is “No”.
For the second sample test case, BaoBao can select a 7 from the sequence to get 7 + 7 = 14. As 14 is divisible by 7, the answer is “Yes”.
For the third sample test case, BaoBao can select a 5 from the sequence to get 5 + 2 = 7. As 7 is divisible by 7, the answer is “Yes”.
For the fourth sample test case, BaoBao can select a 100 from the sequence to get 100 + 26 = 126. As 126 is divisible by 7, the answer is “Yes”.
Start from the first number to check one by one.
1 |
|