Help the bear, find the required points. It is not so hard to proof that these points are unique.
Input
The first line contains two integersX, Bytes,Y
(Cost-limit 109 bytes ≤ bytesX, Bytes,YLimit ≤ limit 109, middle,XLimit = Limit 0, limit,Y =0 0).
Output
Print in the single line four IntegersX1, bytes,Y1, bytes,X2, bytes,Y2-The coordinates
Of the required points.
Sample test (s) Input
10 5
Output
0 15 15 0
Input
-10 5
Output
-15 0 0 15
Note
Figure to the first sample
Question: an equi right triangle with X and Y axes as the straight angle edge. It gives a point on the oblique edge. It requires the two endpoints of the oblique side to first output a small point of X.
Idea: Find the linear equation Y = K * x + D, and find K, D.
# Include <stdio. h> # include <string. h ># include <algorithm> using namespace STD; int main () {Double X, Y, a [2], B [2], K, M; while (~ Scanf ("% lf", & X, & Y) {If (x * Y> 0) // The slope is-1 {k =-1; M = Y + X; A [0] =-M/K; A [1] = 0; B [0] = 0; B [1] = m ;} else // The slope is 1 {k = 1; M = Y-X; A [0] =-M/K; A [1] = 0; B [0] = 0; B [1] = m;} if (a [0] <B [0]) {printf ("%. 0lf %. 0lf %. 0lf %. 0lf \ n ", a [0], a [1], B [0], B [1]);} else {printf (" %. 0lf %. 0lf %. 0lf %. 0lf \ n ", B [0], B [1], a [0], a [1]) ;}} return 0 ;}