Hackerrank Chocolate Feast Solution

This is the solution of Chocolate Feast under implementation sub domain. You can refer the question Here.

Output :  

Code :

#include<iostream>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        int w,c=x/y;
        w=c;
        while(w>=z)
        {
            int m=w/z;
            c+=m;
            w=w%z;
            w+=m;
        }
        cout<<c<<endl;
    }
}

Well this is it for now..! Thanks for stopping by.. I hope you have liked the program. In case if you have any query you can type it in the comment box or you can contact with me, the contact details are in my profile.      Please don't forget to subscribe.. The subscription is free ;)<

Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Hackerrank Modified Kaprekar Numbers Solution

Bit Stuffing Code Implementation in Java