Solved by 290 users: ...
UserDateAttemptTimeCMSC
abortmozga.ru`29 mar 2009`C++1604.19180
DAV`13 jul 2009`C++1700.01183
DAV`22 jun 2009`C++1400.01189
WsemirZ`21 jul 2008`Kylix3603.69189
abortmozga.ru`29 mar 2009`C++1204.19189
abortmozga.ru`29 mar 2009`C++1104.13190
Stranger`08 dec 2006`FPC504.27190
DAV`22 jun 2009`C++1500.01191
DAV`22 jun 2009`C++1300.01193
yf8888`14 nov 2006`FPC204.29194
Stranger`02 oct 2006`FPC304.26200
tomek`20 mar 2006`C++305.00201
DAV`16 mar 2009`C++900.01202
DmitryLyugaevKantSU`20 nov 2007`Kylix304.19203
VArt`12 jan 2009`C++204.09218
fetetriste`04 aug 2008`C++1700.01226
fetetriste`04 aug 2008`C++1800.01226
BobicZdoh`16 mar 2006`Python113.77228
fetetriste`03 aug 2008`C++1600.01229
 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 DevGroupThe page was generated in 190ms