Computer Science, asked by dshahi1511, 1 year ago

The activist jump across the wall.he is able to jump x meters,but because of slippary wall he falls y enters after each jump to escape he has cross N numbers of wall..find total number of jumps he has to make to escape the jail

Answers

Answered by sawakkincsem
0
You should write a program, first of all, you will add input format which will be the following: 

1. An integer depicting X
2. An integer depicting Y
3. And an array of N integers which will be having the height of the wall

following will be the constraints:

1< = X <=109
1< = Y <= 105

and the output format will be the following:
The program should be able to return the total number of jumps which are required to escape.

for example there is a test case
sample input 
10
1
1
10

the sample output will be 
1

the explanation for this is:
that the activist can jump 10 meters high but also slides down by 1 meter and there is a 1 wall which he wants to jump and the height of the wall is also 10 meters. So when he jumps 10 meters in the first attempt he will be able to cross the wall easily in the first attempt.
Similar questions