Lucky 7


Time Limit: 1 Second      Memory Limit: 65536 KB

BaoBao has just found a positive integer sequence  of length  from his left pocket and another positive integer  from his right pocket. As number 7 is BaoBao's favorite number, he considers a positive integer  lucky if  is divisible by 7. He now wants to select an integer  from the sequence such that  is lucky. Please tell him if it is possible.

Input

There are multiple test cases. The first line of the input is an integer  (about 100), indicating the number of test cases. For each test case:

The first line contains two integers  and  (), indicating the length of the sequence and the positive integer in BaoBao's right pocket.

The second line contains  positive integers  (), indicating the sequence.

Output

For each test case output one line. If there exists an integer  such that  and  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".

原题地址:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5762

题意:

给你一个n,和b,然后一个长度为n的数组A 问你是否有数组A的元素加上B能被7整除 如果可以输出Yes,不能输出No

代码:

#include<bits/stdc++.h>
using namespace std; int a[];
int main()
{
std::ios::sync_with_stdio(false);
int t;
while(cin>>t){
while(t--){
int n,num;
cin>>n>>num;
int flag=;
for(int i=;i<n;i++){
cin>>a[i];
}
for(int i=;i<n;i++){
if((a[i]+num)%==){
flag=;break;
}
}
if(flag)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
return ;
}

The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - M Lucky 7的更多相关文章

  1. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - L Doki Doki Literature Club

    Doki Doki Literature Club Time Limit: 1 Second      Memory Limit: 65536 KB Doki Doki Literature Club ...

  2. 2018浙江省赛(ACM) The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

    我是铁牌选手 这次比赛非常得爆炸,可以说体验极差,是这辈子自己最脑残的事情之一. 天时,地利,人和一样没有,而且自己早早地就想好了甩锅的套路. 按理说不开K就不会这么惨了啊,而且自己也是毒,不知道段错 ...

  3. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - J CONTINUE...?

    CONTINUE...? Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge DreamGrid has  clas ...

  4. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - B King of Karaoke

    King of Karaoke Time Limit: 1 Second      Memory Limit: 65536 KB It's Karaoke time! DreamGrid is per ...

  5. The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple -A Peak

    Peak Time Limit: 1 Second      Memory Limit: 65536 KB A sequence of  integers  is called a peak, if ...

  6. ZOJ 4033 CONTINUE...?(The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple)

    #include <iostream> #include <algorithm> using namespace std; ; int a[maxn]; int main(){ ...

  7. The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - F 贪心+二分

    Heap Partition Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge A sequence S = { ...

  8. The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - C 暴力 STL

    What Kind of Friends Are You? Time Limit: 1 Second      Memory Limit: 65536 KB Japari Park is a larg ...

  9. ZOJ 3962 E.Seven Segment Display / The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple E.数位dp

    Seven Segment Display Time Limit: 1 Second      Memory Limit: 65536 KB A seven segment display, or s ...

随机推荐

  1. bzoj1726 第二短路

    一道严格次短路题,WA了一下午回家才发现bellman_ford中的vis [ o ] = false 写成了 vis [ S ] = false.被自己脑残了一脸.... #include<c ...

  2. HDU 多校对抗赛第二场 1010 Swaps and Inversions

    Swaps and Inversions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  3. missing blocks错误

    Datanode的日志中看到: 10/12/14 20:10:31 INFO hdfs.DFSClient: Could not obtain block blk_XXXXXXXXXXXXXXXXXX ...

  4. centos7 mysql cluster集群搭建基于docker

    1.准备 mn:集群管理服务器用于管理集群的其他节点.我们可以从管理节点创建和配置集群上的新节点.重新启动.删除或备份节点. db2/db3:这是节点间同步和数据复制的过程发生的层. db4/db5: ...

  5. postfix导致maillog填满磁盘空间的巨坑!

    双休日回家pull在公司修改的代码...于是菜鸟的linux探索之路开始了 1.df -f发现磁盘又占满了(之前是node的error) 2.发现maillog整整10个G,无数条(Jul 7 04: ...

  6. 精通JS正则表达式(转)

    精通JS正则表达式,讲的比较详细,学习正则表达式的朋友可以参考下.    正则表达式可以: •测试字符串的某个模式.例如,可以对一个输入字符串进行测试,看在该字符串是否存在一个电话号码模式或一个信用卡 ...

  7. peity(jQuery 插件可以将元素内容转换为一个小的 <svg> 饼图,圆环图,条形图和折线图)

    API地址:https://www.awesomes.cn/repo/benpickles/peity 实例效果

  8. 图论:Stoer-Wagner算法

    利用Stoer-Wagner算法求无向图最小割 直接给出算法描述和过程实现: 算法步骤: . 设最小割cut=INF, 任选一个点s到集合A中, 定义W(A, p)为A中的所有点到A外一点p的权总和. ...

  9. ACM-ICPC 2018 南京赛区网络预赛 Sum

    A square-free integer is an integer which is indivisible by any square number except 11. For example ...

  10. 将数据导入hive,再将hive表导入hbase

    将数据到入hive的无分区表,再将无分区表导入hive的有分区表: --备份 create table tds_package_secinfobk as select * from tds_packa ...