Submit | All submissions | Best solutions | Back to list |
GEOM - Geometry and a Square |
Is there anyone who doesn't love geometry?! Just imagine: on the plane you are given a square ABCD, with vertices given in the clockwise direction. Also given is a point P which is different from all of A, B, C or D. Have you imagined it? Interested? Ok, let's continue!
Through vertex A a line a is drawn that is perpendicular to line BP, through vertex B a line b is drawn that is perpendicular to line CP, through vertex C a line c is drawn that is perpendicular to line DP, through vertex D a line d is drawn that is perpendicular to line AP. Do the lines a, b, c and d cross each other in one point? Ok, it depends on what the square is and what point P is given. Write the program that discovers if these lines cross in one point, and if so, finds the coordinates of this point.
Input
In the first line you are given the integer coordinates of the point in which diagonals of the square intersect. In the second line you are given one integer - the length of the side of the square. In the third line you are given the integer coordinates of point P. The integers do not exceed 100, in terms of absolute value.
Output
For each test case you must output YES if the sought point exists, and NO otherwise. If you answer YES then in the second line you must output the coordinates of the intersection point. Coordinates must be rounded to one digit after the point.
Example
Input: 10 10 20 5 12 Output: YES 8.0 5.0
Author: Filimonenkov D.O.
Added by: | Roman Sol |
Date: | 2006-05-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST WHITESPACE |
Resource: | ZCon 2007 |