[线上网址](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");}
}

转载于:https://www.cnblogs.com/Roni-i/p/8970899.html

ZOJ18th省赛 Lucky 7相关推荐

  1. HDU 5676 ztr loves lucky numbers

    -亚信科技,巴卡斯(杭州),壹晨仟阳(杭州),英雄互娱(杭州)  (包括2016级新生)除了校赛,还有什么途径可以申请加入ACM校队?  ztr loves lucky numbers Time Li ...

  2. 操作es_ES打野皇子操作看呆Uzi:这哥们肯定是深得Lucky真传

    北京时间2020年3月27号,英雄联盟LPL春季赛线上赛迎来了LNG与ES之间的对决.最终,ES在落后一局的情况之下,成功完成了让一追二,战胜了LNG的同时也是获得了四连胜的战绩. 值得一提的是,因为 ...

  3. 山东科技大学第二届ACM校赛解题报告

    这次校赛的目的,是为了省赛测试各种程序是否有问题. 热身赛的逗比题有点打击我,感觉正式赛应该不会出这种问题.开始的时候直接上了A题,然后大概是第六,前面好多友情队,正式队排名第二. 然后读了读B题,稍 ...

  4. 程序设计天梯赛——T1(15分)java版

    程序设计天梯赛--java版 文章目录 程序设计天梯赛--java版 3-个位数统计 输入格式: 输出格式: 输入样例: 输出样例: 5-考试座位号 输入格式: 输出格式: 输入样例: 输出样例: 1 ...

  5. 天梯赛L1(1-80)

    目录 L1-001 Hello World L1-002 打印沙漏 L1-003 个位数统计 L1-004 计算摄氏温度 L1-005 考试座位号 L1-006 连续因子 L1-007 念数字 L1- ...

  6. 团体程序设计天梯赛 -- 练习集 (L1合集)

    文章目录 L1-001 Hello World (5 分) L1-002 打印沙漏 (20 分) L1-003 个位数统计 (15 分) L1-004 计算摄氏温度 (5 分) L1-005 考试座位 ...

  7. [NKNY]寒假培训《NY寒假有奖欢乐赛 》总结

    说明 NY寒假有奖欢乐赛 类别 日常作业题目列表 考试规则 信息学奥赛规则 开始时间 2022/1/22 9:00:00 结束时间 2022/1/22 12:20:00 总时长 3小时 20分钟 参考 ...

  8. 天梯赛L1级别80道题解

    题目地址:天梯赛 1 #include<bits/stdc++.h> using namespace std; int main() {cout<<"Hello Wo ...

  9. CQUCQUPT联合狂欢赛小结

    概述:今天25道题,AC了11道,不到一半的题.惭愧惭愧.不过还是颇有收获的.就AC题目和今晚补的题做些小结 狂欢赛链接:http://acm.hust.edu.cn/vjudge/contest/v ...

最新文章

  1. Spring MVC集成Spring Data Reids和Spring Session实现Session共享
  2. Exception in thread “main“ org.apache.ibatis.exceptions.PersistenceException奇葩解决方案
  3. myeclipse和输入法冲突的问题
  4. linux 网卡是块设备吗,什么是网络块设备(Network Block Device)?
  5. Spring MVC原理学习之how is return type handled
  6. Vue中如何实现代码高亮功能?
  7. 程序员加班制作了30张可视化大屏模板,套用数据直接用
  8. 【LOJ119】单源最短路 模板
  9. Java多线程电影院_java 多线程-快乐订座电影院
  10. Angular纯前端实现table表格导出excel的xls格式
  11. [我教你学]四步解决微软鼠标单击变双击问题
  12. C语言输出三阶魔方阵
  13. 计算机应用中英文缩写ai表示,2014年全国计算机等级一级考试题库
  14. 三维模型下构件关联类型系统展示
  15. 垃圾回收器ZGC应用分析总结
  16. 十大低代码开发平台排行榜,低代码开发平台哪个好用?
  17. 自动驾驶之车辆运动学与动力学模型
  18. git 的使用以及如何解决git冲突问题
  19. System.Diagnostics.Process 用处
  20. ssl模拟赛(2019.4.27)

热门文章

  1. Cacti 插件中setup.php 文件的编写
  2. 家园签到:无忧币天天送,连续领礼更多!【家园帮助】
  3. Leetcode 319. 灯泡开关 解题思路及C++实现
  4. 使用scipy实现简单神经网络
  5. 高数第七版_习题解答_3-1行列式习题
  6. fluentftp 积极拒绝_【新时代文明实践】光明街道光大社区开展“光盘行动 拒绝浪费 从我做起”新时代文明实践活动...
  7. profiles 配置详解
  8. 把对象的创建交给spring来管理——  1.创建bean的三种方式     2.bean对象的作用范围     3.bean对象的生命周期
  9. [Unity3D]Script 脚本所有编译器属性详解
  10. Python+opencv 机器视觉 - 基于霍夫圈变换算法检测图像中的圆形实例演示