Chocolate Feast

 https://www.hackerrank.com/challenges/chocolate-feast/problem

int chocolateFeast(int n, int c, int m) {
            int ans=0;
        ans+=n/c;
        int x=n/c;
        while(x>=m){
            ans+=x/m;
            x=x/m+x%m;
        }
        return ans;
}

 

Comments

Popular posts from this blog

Perfect Peak of Array

Is Rectangle?

Sort array with squares!