-
Notifications
You must be signed in to change notification settings - Fork 0
/
LittleElephantAndCandies.java
38 lines (33 loc) · 1.02 KB
/
LittleElephantAndCandies.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package problems.codechef;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
/**
* Created by Arpit on 26-Dec-15.
*/
public class LittleElephantAndCandies {
public static void main(String[] args) {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n,c,t,sum;
String s[];
try {
t= Integer.parseInt(br.readLine());
for (int i = 0; i < t; i++) {
s=br.readLine().split("\\s");
n=Integer.parseInt(s[0]);
c=Integer.parseInt(s[1]);
sum=0;
s=br.readLine().split("\\s");
for (int j = 0; j < n; j++) {
sum=sum+Integer.parseInt(s[j]);
}
if (sum<=c) System.out.println("Yes");
else System.out.println("No");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}