# FILLCANDIES-EDITORIAL

Testers: tabr, tejas10p
Editorialist: kiran8268

681

None

# PROBLEM:

The objective is to find the minimum number of bags Chef needs so that he can put every candy into bags, where each bag has K pockets and each pocket can have a maximum of M candies.

# EXPLANATION:

Given each bag has K pockets which can have maximum of M candies, the maximum number of candies that a bag can hold is K\times M.
Thus if:

• N<(K\times M), the minimum number of bags required is 1.
*N%(K\times M)=0,the minimum number of bags required is N \div (K\times M)
*N%(K\times M)>0,the minimum number of bags required is [N \div (K\times M) ]+1

# TIME COMPLEXITY:

Time complexity is O(1).

# SOLUTION:

Editorialist's Solution
	int t;
cin>>t;
while(t--)
{
int n,m,k;
cin>>n>>k>>m;
if(n<m*k)
cout<<"1"<<"\n";
else if(n%(k*m)==0)
cout<<n/(k*m)<<"\n";
else if(n%(k*m)>0)
cout<<(n/(k*m))+1<<"\n";
}