Segment and Circles
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 64 megabytes
In a plane, there is a system of concentric circles centered at the origin, with radii of 1, 2, 3, and so on. Additionally, there is a line segment on the plane with endpoints at (X_1, Y_1) and (X_2, Y_2). Your task is to determine how many times this line segment intersects with the system of circles.
Input: The first line of the input contains 4 integers: X_1, Y_1, X_2, Y_2. Each of these numbers is no greater than 10^3 in absolute value. The segment is guaranteed to have a non-zero length.
Output: Write the number of intersection points to the output.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 28%