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. n=var.nextInt();
  17. c=var.nextInt();
  18. int a[]=new int[n];
  19. for(i=0;i<n;i++)
  20. {
  21. a[i]=var.nextInt();
  22. sum=sum+a[i];
  23. }
  24. if(sum<=c)
  25. System.out.println("Yes");
  26. else
  27. System.out.println("No");
  28.  
  29. }
  30. }
  31. }
Success #stdin #stdout 0.1s 380736KB
stdin
3
2 3
1 1
3 7
4 2 2
2 9
1 1
stdout
Yes
No
No