Solved by 257 users: ...Minimal sum of distances
Time limit = 5
Let's consider
N points on the plane
XY, defined by their cartesian
coordinates. These points are focuses. Each focus has an additional value
f that is the power of the focus. You have to find such point
A(
x,
y), that sum
of
fi *
D( (
xi,
yi), (
x,
y) ) is minimal of all possible.
fi is the power of
i-th focus;
D(
P,
Q) is distance between points
P and
Q; (
xi,
yi) are the
coordinates of
i-th focus.
Input: the first line of input contains 1 integral number N, 1 ≤ N ≤ 100. The first
line is followed by N lines, each consisting of 3 numbers: xi, yi, fi,
where xi, yi are cartesian coordinates of i-th focus and fi is its power.
xi and yi are integer values, -15 ≤ xi, yi ≤ 15. fi is also integer, 0 < fi < 20.
Output: your program have to output two float values coordinates of point A.
Values must be written with two digits after decimal point. Allowed deviation
for output is +-1 in last sign.
Input#1
1
0 0 1
|
Output#1
0.00 0.00
|
Input#2
2
0 0 2
0 1 1
|
Output#2
0.00 0.00
|
Input#3
3
0 0 10
0 1 10
1 0 10
|
Output#3
0.21 0.21
|
Author:
Malyh Anton
04/25/2003
<PREV | Problem set | Search related messages | NEXT>