[Solution] Fill Candies solution codechef

Fill Candies solution 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.

Table of Contents

[Solution] Fill Candies solution codechef

  • 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

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

Sample Input 1 

4
6 2 3
3 1 2
8 4 1
25 4 2

[Solution] Fill Candies solution codechef

 

1
2
2
4

Explanation

Test case 11: Chef puts 33 candies in the first pocket of a bag and the remaining 33 candies in the second pocket. Thus Chef will need only one bag.

Test case 22: Chef puts 22 candies in the only pocket of the first bag and the remaining 11 candy in the only pocket of the second bag. Thus Chef will need two bags.

Test case 33: Chef puts 44 candies in the first bag, one candy in each of the 44 pockets and the same for the second bag. Thus Chef will need two bags.

Test case 44: Chef puts 22 candies in each of the 44 pockets of three bags, one candy in a pocket of the fourth bag.

For Solution

Click Here

Leave a Comment