An activist, of a banned organisation, plans to escape from Bhopal jail. The activist is basically a monkey man and is able to jump across the wall. He practises to cross a wall. He is able to jump 'X' meters, but because of the slippery wall he falls 'Y' meters after each jump. To escape from jail, he has to cross 'N' number of walls, where height of each wall is given in an array.
Answers
Answered by
0
An integer depicting X.
An integer depicting Y.
An array of N integers, which will be having the height of the wall .
The constraint will be-
1< = X <= 109
1< = X <= 105
The program should be able to return the total number of jumps which are required to escape.
sample input
10
1
1
10
the sample output will be
1.
It implies that the activist can jump 10 meters high but will also slip down by 1 metre. The height of the wall is 10 metres. Thus, he will be able to cross the wall in the first attempt only.
Similar questions