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