狗题卡我精度……sol
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cmath>
using namespace std;
int n;
struct Point{
double x, y;
}pt[100005], O;
double r;
const double eps=1e-10;
double dis(const Point &u, const Point &v){
return sqrt((u.x-v.x)*(u.x-v.x)+(u.y-v.y)*(u.y-v.y));
}
void getO(const Point &u, const Point &v, const Point &w){
double a=u.x-v.x;
double b=u.y-v.y;
double c=v.x-w.x;
double d=v.y-w.y;
double e=a*(u.x+v.x)+b*(u.y+v.y);
double f=c*(v.x+w.x)+d*(v.y+w.y);
O.x = (e*d-b*f)/(a*d-c*b)/2;
O.y = (c*e-a*f)/(b*c-a*d)/2;
}
bool inCircle(const Point &u){
return dis(u,O)<=r+eps;
}
int main(){
srand(time(NULL));
cin>>n;
for(int i=1; i<=n; i++)
scanf("%lf %lf", &pt[i].x, &pt[i].y);
random_shuffle(pt+1, pt+1+n);
O = pt[1];
for(int i=1; i<=n; i++)
if(!inCircle(pt[i])){
O = pt[i];
for(int j=1; j<i; j++)
if(!inCircle(pt[j])){
O = (Point){(pt[i].x+pt[j].x)/2, (pt[i].y+pt[j].y)/2};
r = dis(pt[i], pt[j]) / 2.0;
for(int k=1; k<j; k++)
if(!inCircle(pt[k])){
getO(pt[i], pt[j], pt[k]);
r = dis(O, pt[k]);
}
}
}
printf("%.10f
%.10f %.10f
", r, O.x, O.y);
return 0;
}