• + 0 comments

    This problem is a geometric series so can be solved with maths.

    int chocolateFeast(int n, int c, int m) {
        return ((long)(n/c)*m-1)/(m-1);
    }