You are viewing a single comment's thread. Return to all comments →
Solution using math in C++, might give wrong answer if 1.0/(m-1) doesn't have enough precision. Passed all test cases still
int chocolateFeast(int n, int c, int m) { return (n/c) * (1 + 1.0/(m-1) ) - !((n/c)%(m-1)); }
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 →
Solution using math in C++, might give wrong answer if 1.0/(m-1) doesn't have enough precision. Passed all test cases still