atcoder#ARC070A. [ABC056C] Go Home
[ABC056C] Go Home
Score : points
Problem Statement
There is a kangaroo at coordinate on an infinite number line that runs from left to right, at time . During the period between time and time , the kangaroo can either stay at his position, or perform a jump of length exactly to the left or to the right. That is, if his coordinate at time is , he can be at coordinate , or at time . The kangaroo's nest is at coordinate , and he wants to travel to coordinate as fast as possible. Find the earliest possible time to reach coordinate .
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
Output
Print the earliest possible time for the kangaroo to reach coordinate .
6
3
The kangaroo can reach his nest at time by jumping to the right three times, which is the earliest possible time.
2
2
He can reach his nest at time by staying at his position during the first second, and jumping to the right at the next second.
11
5