fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t, n, c, ak, i;
  7. cin>>t;
  8. while(t--) {
  9. cin>>n>>c;
  10. ak=0;
  11. while(n--) { cin>>i; ak=ak+i; }
  12. if(ak<=c) cout<<"Yes"<<endl;
  13. else cout<<"No"<<endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 3300KB
stdin
2
2 3
1 1
3 7
4 2 2
stdout
Yes
No