GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 27 April 2022

Presents for Cheffina CodeChef Solution | CodeChef Problem Solution 2022

Chef has fallen in love with Cheffina, and wants to buy N gifts for her. On reaching the gift shop, Chef got to know the following two things:

  • The cost of each gift is 1 coin.
  • On the purchase of every 4th gift, Chef gets the 5th gift free of cost.

What is the minimum number of coins that Chef will require in order to come out of the shop carrying N gifts?

Input Format

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains an integer N, the number of gifts in the shop.
Solution Click Below:- 

Output Format

For each test case, output on a new line the minimum number of coins that Chef will require to obtain all N gifts.

Constraints

  • 1T1000
  • 1N109

Sample Input 1 

2
5
4

Sample Output 1 

4
4

Explanation

Test case 1: After purchasing 4 gifts, Chef will get the 5th gift free of cost. Hence Chef only requires 4 coins in order to get 5 gifts.

Chef and Chapters CodeChef Solution | CodeChef Problem Solution 2022

Presents for Cheffina CodeChef Solution | CodeChef Problem Solution 2022

Chef and Bird farm CodeChef Solution | CodeChef Problem Solution 2022

Valentine Vex CodeChef Solution | CodeChef Problem Solution 2022

Buying Sweets CodeChef Solution | CodeChef Problem Solution 2022

Reduce to 1 CodeChef Solution | CodeChef Problem Solution 2022

Three Arrays CodeChef Solution | CodeChef Problem Solution 2022

Test case 2: Chef will require 4 coins in order to get 4 gifts.

Join Now for Solution:- 

No comments:

Post a Comment