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. Write a program to find out the total number of jumps he has make, to escape from the Bhopal jail. Input Format Your program need to take 3 integers from STDIN, where: First line contains an integer depicting X Second line contains an integer depicting Y Third line contains an integer depicting N(total number of walls) Next N lines contain heights of N walls
Answers
Answered by
0
An integer depicts X ( able to jump this meters)
An integer depicts Y ( but falls on this)
Array of N integers, which depicts the wall height.
The constraint will be-
1 ≤ X ≤ 109
1 ≤ X ≤ 105
The program must be ensured to return the whole number of jumps that are required for escaping an activist.
Input
10
1
1
10
Output would be,
1
It is depicted that an activist could jump 10 meters high but would also slip down by 1 meter. The height of the wall is 10 meters. So it is only possible for him to cross the wall in the 1 st try only.
Similar questions
Hindi,
7 months ago
English,
7 months ago
Science,
1 year ago
Math,
1 year ago
Political Science,
1 year ago