#K9146. Balanced Weights Checker

    ID: 37980 Type: Default 1000ms 256MiB

Balanced Weights Checker

Balanced Weights Checker

Given several test cases, each test case consists of a positive integer n indicating the number of weights, a counterweight x, and a list of n distinct weights. For each weight, determine if it can be "balanced" in the sense that it is divisible by the counterweight x. Formally, for each weight w, check whether \[ w \bmod x = 0 \] If the above equation holds, print YES; otherwise, print NO.

The input is read from standard input and the answer for each weight is printed on its own line to standard output.

inputFormat

The first line contains a single integer T, the number of test cases. Each test case is described as follows:

  • The first line of each test case contains two integers n and x, where n is the number of weights and x is the counterweight.
  • The second line of each test case contains n space-separated integers representing the weights.

Input is given via standard input.

outputFormat

For each test case, output n lines. For each weight, print YES if the weight is divisible by x (i.e. if w mod x = 0), otherwise print NO. Output is printed to standard output.

## sample
1
5 5
10 15 20 25 30
YES

YES YES YES YES

</p>