Description
给出 n n 个整数和一个整数 b b ,问是否存在被 7 7 整除
Input
第一行一整数表示用例组数,每组用例首先输入两个整数 n,b n , b ,之后输入 n n 个整数
(1≤n,ai,bi≤100) ( 1 ≤ n , a i , b i ≤ 100 )
Output
如果存在 ai a i 使得 ai+b a i + b 被 7 7 整除则输出,否则输出 No N o
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
Solution
水题
Code
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f,maxn=100001;
int T,n,a,b;
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&n,&b);
int flag=0;
for(int i=1;i<=n;i++)
{
scanf("%d",&a);
if((a+b)%7==0)flag=1;
}
printf("%s\n",flag?"Yes":"No");
}
return 0;
}