Program to find number of jumps he has to make to escape from jail
Answers
Answered by
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.
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
English,
8 months ago
Computer Science,
8 months ago
Science,
1 year ago
Computer Science,
1 year ago