[线上网址](http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=378)

BaoBao has just found a positive integer sequence $a_1, a_2, \dots, a_n$ 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.

Input

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 \le n, b \le 100\)), indicating the length of the sequence and the positive integer in BaoBao's right pocket.

The second line contains \(n\) positive integers \(a_1, a_2, \dots, a_n\) (\(1 \le a_i \le 100\)), indicating the sequence.

Output

For each test case output one line. If there exists an integer \(a_k\) such that \(a_k \in \{a_1, a_2, \dots, a_n\}\) and \((a_k + b)\) is lucky, output "Yes" (without quotes), otherwise output "No" (without quotes).

Sample Input

4

3 7

4 5 6

3 7

4 7 6

5 2

2 5 2 5 2

4 26

100 1 2 4

Sample Output

No

Yes

Yes

Yes

Hint

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".

#include<bits/stdc++.h>

using namespace std;
int a[1005];
int main()
{
int t;;
cin>>t;
while(t--){
int f=0;
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++){
cin>>a[i];
if((a[i]+k)%7==0) f=1;
}
f?puts("Yes"):puts("No");
}
}

最新文章

  1. CentOS升级openssl
  2. s3c2440 上txt 小说阅读器
  3. Java虚拟机学习(1):体系结构 内存模型
  4. (转) Deep Reinforcement Learning: Playing a Racing Game
  5. JavaScript引用方法说明
  6. Xcode 文件删除拷贝 出现的问题
  7. Solaris系统管理(一)
  8. Standalone HBase
  9. gitlab ce 中删除空项目之后,没有删除掉,访问500
  10. 第六十三篇、runtime实现归解档
  11. CODEVS 1090 加分二叉树
  12. SQL server 变量if,while,存储过程
  13. Axiom3D学习日记 2.介绍SceneManager,SceneNode,Entity
  14. Netty-Websocket 根据URL路由,分发机制的实现
  15. .NET常用第三方库(包)总结
  16. 【Maven】Select Dependency 无法检索
  17. salesforce lightning零基础学习(九) Aura Js 浅谈二: Event篇
  18. Linux用户管理机制
  19. 3.13. Notepad++中Windows,Unix,Mac三种格式之间的转换
  20. 手游开发Android平台周边工具介绍

热门文章

  1. 程序员最值得听的歌曲TOP10
  2. runtime如何通过selector找到对应的IMP地址?(分别考虑类方法和实例方法)
  3. js常用框架
  4. lnmp一键安装环境中nginx开启pathinfo
  5. Unit Test Generator使用
  6. selenium启动IE浏览器报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode mu
  7. Python导出sql语句结果到Excel
  8. 解决Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误
  9. 1004 Counting Leaves (30 分)(树的遍历)
  10. Tensorflow实现LSTM识别MINIST