# PROBLEM LINK:

Contest Division 1

Contest Division 2

Contest Division 3

Contest Division 4

Setter: Lavish Gupta

Tester: Felipe Mota, Aryan

Editorialist: Pratiyush Mishra

# DIFFICULTY:

757

# PREREQUISITES:

None

# PROBLEM:

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 4^{th} gift, Chef gets the 5^{th} 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?

# EXPLANATION:

For every fifth gift that Chef buys, it will be free of cost. So from given N gifts if we take a sets of 5 gifts then one gift from each set would be free. So the total number of gifts that would be free of cost would be the number of sets that can be made from N gifts. This would be nothing but \frac{N}{5}. Thus total money spent would be total number of gifts minus the number of gifts that would be free.

# TIME COMPLEXITY:

O(1) for each test case.

# SOLUTION:

Editorialist’s Solution

Setter’s Solution

Tester-1’s Solution

Tester-2’s Solution