<PREV Problem:
NEXT>
Solved by 290 users: ...
UserDateAttemptTimeCMSC
abortmozga.ru29 mar 2009C++1604.19180 
DAV13 jul 2009C++1700.01183 
DAV22 jun 2009C++1400.01189 
WsemirZ21 jul 2008Kylix3603.69189 
abortmozga.ru29 mar 2009C++1204.19189 
abortmozga.ru29 mar 2009C++1104.13190 
Stranger08 dec 2006FPC504.27190 
DAV22 jun 2009C++1500.01191 
DAV22 jun 2009C++1300.01193 
yf888814 nov 2006FPC204.29194 
Stranger02 oct 2006FPC304.26200 
tomek20 mar 2006C++305.00201 
DAV16 mar 2009C++900.01202 
DmitryLyugaevKantSU20 nov 2007Kylix304.19203 
VArt12 jan 2009C++204.09218 
fetetriste04 aug 2008C++1700.01226 
fetetriste04 aug 2008C++1800.01226 
BobicZdoh16 mar 2006Python113.77228 
fetetriste03 aug 2008C++1600.01229 
Languages
C++
153
FPC
79
Kylix
25
C
19
Java
15
Python
2
Ruby
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

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>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 3.235.30.155