CF2193A.DBMB and the Array

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

DBMB and the Array

DBMB had a birthday yesterday. He was gifted an array aa of nn elements and a number xx. But there is one problem: he only likes arrays where the sum of the elements equals ss. To make the array appealing to him, you can perform the following operation any number of times:

  • Choose an index ii (1in1 \le i \le n) and add xx to the number aia_i.

For example, if he was given the array [1,2,3,5][1, 2, 3, 5] and x=2x = 2, you can choose index 33 and get the array [1,2,5,5][1, 2, 5, 5]. Your task is to determine whether the array can appeal to DBMB after any number of operations.

Input

Each test consists of several test cases. The first line contains a single integer tt (1t10001 \le t \le 1000) — the number of test cases. The following describes the test cases.

The first line of each test case contains three integers nn, ss, xx (1n,x101 \le n, x \le 10, 1s1001 \le s \le 100).

The second line of each test case contains nn integers a1,a2,ana_1, a_2, \dots a_n (1ai101 \le a_i \le 10) — the elements of the array gifted to DBMB.

Output

For each test case, output "YES" if the array can appeal to DBMB. Otherwise, output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Note

In the second test case, a=[1,2,3]a = [1, 2, 3], applying the operation on a2a_2 gives us a=[1,4,3]a = [1, 4, 3]. The sum of the array equals ss.

Samples

6
3 3 5
1 1 1
3 8 2
1 2 3
4 7 2
1 1 1 1
3 15 1
2 4 10
2 100 5
4 6
5 12 1
1 2 2 3 2
YES
YES
NO
NO
YES
YES

在线编程 IDE

建议全屏模式获得最佳体验