Description
给出nn个整数和一个整数bb,问是否存在被77整除
Input
第一行一整数表示用例组数,每组用例首先输入两个整数n,bn,b,之后输入nn个整数
(1≤n,ai,bi≤100)(1≤n,ai,bi≤100)
Output
如果存在aiai使得ai+bai+b被77整除则输出,否则输出NoNo
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;
}