-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDbmb.java
More file actions
23 lines (23 loc) · 708 Bytes
/
Dbmb.java
File metadata and controls
23 lines (23 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class Dbmb {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
if (sc.hasNextInt()) {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int s = sc.nextInt();
int x = sc.nextInt();
int currSum = 0;
for (int i = 0; i < n; i++) {
currSum += sc.nextInt();
}
if (s>= currSum&&(s-currSum)% x==0) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}
}