Score : $300$ points
On an $xy$-coordinate plane, is there a lattice point whose distances from two lattice points $(x_1, y_1)$ and $(x_2, y_2)$ are both $\sqrt{5}$?
A point on an $xy$-coordinate plane whose $x$ and $y$ coordinates are both integers is called a lattice point.
The distance between two points $(a, b)$ and $(c, d)$ is defined to be the Euclidean distance between them, $\sqrt{(a - c)^2 + (b-d)^2}$.
The following figure illustrates an $xy$-plane with a black circle at $(0, 0)$ and white circles at the lattice points whose distances from $(0, 0)$ are $\sqrt{5}$. (The grid shows where either $x$ or $y$ is an integer.)
Input is given from Standard Input in the following format:
$x_1$ $y_1$ $x_2$ $y_2$
If there is a lattice point satisfying the condition, print Yes
; otherwise, print No
.
0 0 3 3
Yes
so point $(2, 1)$ satisfies the condition. Thus, Yes
should be printed.
One can also assert in the same way that $(1, 2)$ also satisfies the condition.
0 1 2 3
No
No lattice point satisfies the condition, so No
should be printed.
1000000000 1000000000 999999999 999999999
Yes
Point $(10^9 + 1, 10^9 - 2)$ and point $(10^9 - 2, 10^9 + 1)$ satisfy the condition.