rt
code:
#include<bits/stdc++.h>
using namespace std;
int n;
constexpr double tmax=2000,tmin=1e-10,tlower=.97;
class point
{
public:
long double x0,y0;
int w;
inline const long double dist(const point p)const
{
return sqrt(powl(x0-p.x0,2)+powl(y0-p.y0,2))*p.w*w;
}
}pt[1007],bestp=point{-10001,-10001,1};
inline long double compute(point p)
{
long double ans=0;
for(int i=0;i<n;i++)
{
ans+=p.dist(pt[i]);
}
return ans;
}
inline long double dmkr(int r)
{
unsigned int rs=abs(r);
long double rsr=(long double)rs/INT_MAX*20000-10000;
return rsr;
}
void sa(int rand_seed)
{
mt19937_64 mtr(rand_seed);
for(double t=tmax;t>tmin;t*=tlower)
{
point p=point{dmkr(mtr()),dmkr(mtr()),1};
long double res=compute(p),rbestp=compute(bestp);
if(res<rbestp)rbestp=res,bestp=p;
else if(exp((res-rbestp)/t)*INT_MAX*5<abs((int)mtr()))
bestp=p;
}
}
void solve()
{
mt19937 mt(time(0));
while(clock()<2*CLOCKS_PER_SEC)sa(mt());
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>pt[i].x0>>pt[i].y0>>pt[i].w;
}
solve();
printf("%.3f %.3f",(float)bestp.x0,(float)bestp.y0);
return 0;
}