from math import *
from sys import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
input =stdin.readline
inp = lambda : int(input())
li = lambda : list(map(int,input().split()))
lb = lambda : list(map(int,input().split()[0]))
ls = lambda : list(input())
bi = lambda n: bin(n).replace("0b", "")
yn = lambda f: print('NYOE S'[f::2])
srp = lambda s,i,c : s[:i]+c+s[i+1:]
'''def isprime(a):
if a==2: return True
elif a%2==0: return False
n=3
while n<=a**0.5:
if a%n==0:
return False
n+=2
return True
'''
'''def nf(n,a):
b=a*a
c=b*a
d=c*a
e=n
ct=0
while e%a==0:
if e%d==0:
ct+=4
e=e//d
if e%c==0:
ct+=3
e=e//c
if e%b==0:
ct+=2
e=e//b
if e%a==0:
ct+=1
e=e//a
return ct
t='abcdefghijklmnopqrstuvwxyz'
'''
def ss(s,a):
return str(a) in str(s)
def solve(__=1):
for _ in range(__):
q,d=li()
a=li()
for e in a:
if ss(e,d):
print("YES")
else:
while not ss(e,d) and e>0:
e-=d
yn(e>0)
if __name__ == "__main__":
solve(inp())
// Problem: B. Nezzar and Lucky Number
// Contest: Codeforces - Codeforces Round 698 (Div. 2)
// URL: https://codeforces.com/problemset/problem/1478/B
// Memory Limit: 512 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main()
{
fast();
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
if(a>=10*k)
{
yes
continue;
}
bool f=0;
while(a>0)
{
a-=k;
if(a%10==0)
{
f=1;
break;
}
}
if(f)
yes
else
no
}
}
}
1409A - Yet Another Two Integers Problem | 977A - Wrong Subtraction |
263A - Beautiful Matrix | 180C - Letter |
151A - Soft Drinking | 1352A - Sum of Round Numbers |
281A - Word Capitalization | 1646A - Square Counting |
266A - Stones on the Table | 61A - Ultra-Fast Mathematician |
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |
734A - Anton and Danik | 1300B - Assigning to Classes |
1647A - Madoka and Math Dad | 710A - King Moves |
1131A - Sea Battle | 118A - String Task |
236A - Boy or Girl | 271A - Beautiful Year |
520B - Two Buttons | 231A - Team |
479C - Exams | 1030A - In Search of an Easy Problem |
158A - Next Round | 71A - Way Too Long Words |