You are viewing a single comment's thread. Return to all comments →
Here's one way
int chocolateFeast(int n, int c, int m) { int bars,w; bars=n/c; if(bars<m) { return bars; } else if(bars>m) { w=bars; while(w>=m) { bars+=w/m; w=w%m+w/m; } } else bars+=1; return bars; }
Seems like cookies are disabled on this browser, please enable them to open this website
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
Here's one way