We are given six integers:
,
,
,
,
,
such that
.
These numbers are coefficients in equations of two intersecting lines:
,
.
,
).
You are given a point
with integer coordinates representing one part. Find a point with integer coordinates
representing the same part, such that its distance from the point of intersection
of lines
and
is least possible.
Write a program which:
and
and a point
representing one part of plane,
and
,
The first line of the standard input contains three numbers
, separated by single spaces -
the coefficients of
's equation.
The second line contains three numbers
, separated by single spaces -
the coefficients of
's equation.
It is true that
.
The third and last line contains two integers
,
separated by a single space. They are the coordinates of a point
representing one part of plane.
Point
does not belong to any of lines
,
.
For every number
from the input it is true that
.
Your program should write to the standard output two numbers
, separated by a single space - the coordinates of a point
representing the given part, closest to the point of
intersection of lines
and
.
If there are many such points, your program should output only
one of them.
For the input data:
1 -1 1 2 -3 1 5 4
the correct result is:
2 2

Task author: Jakub Pawlewicz.
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.