CodechefMay 21, 2025

Fill Candies

Hazrat Ali

Codechef

Chef received NN candies on his birthday. He wants to put these candies in some bags. A bag has KK pockets and each pocket can hold at most MM candies. Find the minimum number of bags Chef needs so that he can put every candy into a bag.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of a single line containing three space-separated integers N,K,MN,K,M.

Output Format

For each test case, print the minimum number of bags Chef needs so that he can put all the candies in one of the bags.

Constraints

  • 1≤T≤1000
  • 1≤N,K,M≤100

Sample 1:

Input
4
6 2 3
3 1 2
8 4 1
25 4 2
Output
1
2
2
4


Solution

for _ in range(int(input())):
    m,n,k=map(int,input().split(' '))
    
    total_candies = k*n
    
    if m%total_candies==0:
        print(m//total_candies)
    else:
    
        print((m//total_candies)+1)

 




 

Comments