Maximum subtraction

3.7

13 votes
Basic Math, Easy-Medium, Mathematics, Mathematics
Problem

You are given three integers n, m, and k. In a single move, you can subtract any integer in the range from 1 to m from n, but you are not be allowed to subtract this integer during the next k moves. What is the minimum number of moves required to make n strictly smaller than 0?
 

Input format

The first and only line of input contains three integers  n,m,k

Output format

Print an integer denoting the answer to the problem.

Constraints 

1n,m109

1k105

k<m

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the first move, you can subtract 1, in the second move you can subtract 3, in the third move you can subtract 4. So, you can make n equal to -1 after 3 moves.

Editor Image

?