SP27341 AR2015PF - Jumping Joey
Description
_Please read the problem statement carefully. Mathematical notations and bunch of examples are provided to_
_make the statement friendly._
Once upon a time, there lived a frog named Joey. He has a long pond beside his house. There are
lots of lily pads there, and he likes to jump from one pad to another. He hates to wet himself. Let’s
help Joey to cross the pond.
For the sake of simplicity, let’s assume the pond to be a line segment of length **L**. On this line
segment there are **n** lily pads. Let’s enumerate the lily pads from left to right, that is the leftmost pad
is number **1**, second one from the left is number **2** and so on. At the beginning Joey is at the left
end of the pond. Then he moves to the first pad, then to the second pad and so on. At the end he
moves from the nth pad to the right end of the pond. There are two ways he can move, jump and
swim. He can jump from one place to another if the distance between these two places is no more
than **D** unit. He can swim any times he wants. But as we already said he does not like to wet
himself, so we need to minimize the number of times he swims for going from the left end to the
right end.
However, the situation is not that simple. There are ropes between every two adjacent places. That
is, there is rope between:
a. Left end and first pad
b. Last pad and right end
c. Between every two adjacent pads
Let,
a. **P****i** be the **i**’th pad (**1
Input Format
N/A
Output Format
N/A