FILLCANDIES-EDITORIAL
PROBLEM LINK:
Setter: soumyadeep_21
Testers: tabr, tejas10p
Editorialist: kiran8268
DIFFICULTY:
681
PREREQUISITES:
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:
My Solution
t = int(input())
for _ in range(t):
n, k ,m = map(int, input().split())
if n < (k*m):
print(1)
elif n%(k*m) == 0:
print(n//(k*m))
else:
print((n//(k*m))+1)
3 4 / 4