We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
inthowManyGames(intp,intd,intm,ints){// Return the number of games you can buyvector<int>x;intsum=0;for(inti=p;sum<s;i-=d){if(i>=m){x.push_back(i);}else{x.push_back(m);}sum=accumulate(x.begin(),x.end(),0);}if(sum>s){x.pop_back();}returnx.size();}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Halloween Sale
You are viewing a single comment's thread. Return to all comments →