#P105. [Sleeping Cup #4] Tangent Dancer

[Sleeping Cup #4] Tangent Dancer

Person in Charge

Attention

This problem requires file I/O (tangent.in / tangent.out).

Problem Background

With your help, Team C members finally identified their issues—this one has problems, that one has problems too.

The team leader was deeply disappointed after reviewing the analysis, so he made plans with Sleeping Dolphin to slack off at the dance hall.

Problem Description

Sleeping Cup's Jump is a unique dance move. To perform this move, the dancer must travel from (x1,y1)(x_1,y_1) to (x2,y2)(x_2,y_2) on a 2D stage using as few moves as possible.

This special dance move has an unconventional movement rule—in a single move, the dancer can choose a real number dd and an angle $\varphi \in \left(-\dfrac{\pi}{2},\dfrac{\pi}{2}\right)$, then move from the starting position (x,y)(x,y) to the target position (x+dφ,y+dtanφ)(x+d\varphi, y+d\tan\varphi).

Determine the minimum number of moves required for the dancer.

Input Format

One line containing four integers $x_1, y_1, x_2, y_2\ (-10^9 \le x_1, y_1, x_2, y_2 \le 10^9)$.

Output Format

One line with a single non-negative integer, representing the minimum number of moves required.

Samples

0 0 0 0
0
6 1 7 4
1
8 5 3 2
2

Official Solution

link