Chocolate Feast | Hackerrank solution in C++
Chocolate Feast | Hackerrank Solution
It is an hackerrank problem you can find it by clicking here.
Below given solution is prepared by one of the coder of our.
Solution in C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
int n,c,m;
cin>>n>>c>>m;
int count;
count = n/c;
int temp = count;
while(temp>=m)
{
count = count + temp/m;
temp = temp/m + temp%m;
}
cout<<count<<endl;
}
return 0;
}

Comments
Post a Comment