Friday, December 27, 2013

codechef LECANDY - "little elephant and candies" solution

codechef LECANDY - "little elephant and candies": http://www.codechef.com/problems/LECANDY

codechef LECANDY - "little elephant and candies" solution: http://ideone.com/9WVsf3

#include <iostream>
using namespace std;

int main() {
// your code goes here
int t, n, c, ak, i;
cin>>t;
while(t--) {
cin>>n>>c;
ak=0;
while(n--) { cin>>i; ak=ak+i; }
if(ak<=c) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}

No comments:

Post a Comment