• + 0 comments

    public static int chocolateFeast(int n, int c, int m) {

        int chacos=n/c;
        int wrappers=chacos;
        while(wrappers>=m)
        {
            var temp=wrappers/m; //used and got chacos
            wrappers%=m; //leftover wrappers
            chacos+=temp; // increasing chacos count
            wrappers+=temp; // As I got new chacos, i will have new wrappers too.     
        }
    
        return chacos;          
    }