Functions
Function-18
Function-19
Function-20
~/algor $ cat problems/funksiya-eng-yaqin-nuqta
Closest point
Easy
1000 ms
128 MB
25%
Write a function Closest(a, b, c, d): of the points $P(a; b)$ and $Q(c; d)$, it returns $1$ if $P$ is closer to the origin $O(0; 0)$, $2$ if $Q$ is closer, and $0$ if the distances are equal.
Example 1: Closest(1, 2, 3, 0) → 1 — the distance to $P$ is $\sqrt{5}$, to $Q$ it is $3$.
Example 2: Closest(4, -4, 0, 3) → 2 — the distance to $P$ is $\sqrt{32}$, to $Q$ it is $3$.
Write only the function body.
Input
One line with four integers $a$, $b$, $c$ and $d$ — the arguments of the function.
Output
The value returned by the function: $1$, $2$ or $0$.
Note
$-10^{7} \le a, b, c, d \le 10^{7}$
Examples
Input #1
1 2 3 0
Output #1
1
Input #2
4 -4 0 3
Output #2
2