思路:
退火就好了……
1.强烈建议题目名称改为“吊打出题人”
2.这种题放oj上啥心态。。。—–hzwer
二分TLE和WA 终于AC了……
//By SiriusRen
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,XX=-100001,YY=100001;
double l,r,w=50000,jyx,jyy;
struct Point{double x,y,wei;}point[10050],b,ans,t;
double dis(Point a){
double res=0;
for(int i=1;i<=n;i++){
jyx=(a.x-point[i].x),jyy=(a.y-point[i].y);
res+=sqrt(jyx*jyx+jyy*jyy)*point[i].wei;
}return res;
}
int main(){
srand(1005730820),scanf("%d",&n),ans.wei=0x3fffffff;
for(int i=1;i<=n;i++)scanf("%lf%lf%lf",&point[i].x,&point[i].y,&point[i].wei);
b.wei=dis(b);
while(w>1e-4){
for(int j=1;j<=30;j++){
double ran=rand();
t.x=b.x+w*sin(ran),t.y=b.y+w*cos(ran),t.wei=dis(t);
if(t.x<XX||t.x>YY||t.y<XX||t.y>YY)continue;
if(t.wei<b.wei)b=t;
}
if(b.wei<ans.wei)ans=b;
w=w*0.9;
}
printf("%.3lf %.3lf\n",t.x,t.y);
}