fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. int t,sum=0;
  11. Scanner var =new Scanner(System.in);
  12. t=var.nextInt();
  13. while(t-- > 0)
  14. {
  15. int i,n,c;
  16. sum = 0;
  17. n=var.nextInt();
  18. c=var.nextInt();
  19. int a[]=new int[n];
  20. for(i=0;i<n;i++)
  21. {
  22. a[i]=var.nextInt();
  23. sum=sum+a[i];
  24. }
  25. if(sum<=c)
  26. System.out.println("Yes");
  27. else
  28. System.out.println("No");
  29.  
  30. }
  31. }
  32. }
Success #stdin #stdout 0.1s 380672KB
stdin
3
2 3
1 1
3 7
4 2 2
2 9
1 1
stdout
Yes
No
Yes