传送门

也是模板题,不过要把所有点在一个方向上进行缩放,正交分解一下就行了。

#include <bits/stdc++.h>
#define MAXN 50010
using namespace std;

const double eps=1e-6;

struct vec{
    double x,y;
    vec(double _x=0,double _y=0):x(_x),y(_y){}
    friend vec operator*(vec x,double y){ return vec(x.x*y,x.y*y); }
    friend vec operator+(vec x,vec y){ return vec(x.x+y.x,x.y+y.y); }
    friend vec operator-(vec x,vec y){ return vec(x.x-y.x,x.y-y.y); }
    friend double dot(vec x,vec y){ return x.x*y.x+x.y*y.y; }
    friend double cross(vec x,vec y){ return x.x*y.y-x.y*y.x; }
    friend double dis(vec x,vec y){ return sqrt(dot(x-y,x-y)); }
}a[MAXN];

int n;
double rot,scale;

vec pre_gao(vec x){
    vec axis(cos(rot),sin(rot));
    vec x1=axis*dot(axis,x);
    vec x2=x-x1;
    return x1*(1./scale)+x2;
}

vec get_inter(vec s1,vec d1,vec s2,vec d2){
    double det=cross(d1,d2);
    vec t=vec(d2.y,-d2.x)*(1./det);
    double x=-dot(s1-s2,t);
    return s1+d1*x;
}

vec get_center(vec a,vec b,vec c,double &r){
    vec d=b+(c-b)*.5,e=a+(c-a)*.5;
    vec d1((c-b).y,-(c-b).x),e1((c-a).y,-(c-a).x);
    vec res=get_inter(d,d1,e,e1);
    r=max(max(dis(res,a),dis(res,b)),dis(res,c));
    return res;
}

vec gao3(int x,int y,double &r){
    vec c=a[x]+(a[y]-a[x])*.5;
    r=dis(a[x],a[y])/2;
    for(int i=1;i<x;i++){
        if(dis(a[i],c)<r+eps) continue;
        c=get_center(a[i],a[x],a[y],r);
    }
    return c;
}

vec gao2(int x,double &r){
    vec c=a[x];
    r=0;
    for(int i=1;i<x;i++){
        if(dis(a[i],c)<r+eps) continue;
        c=gao3(i,x,r);
    }
    return c;
}

vec gao1(double &r){
    vec c=a[1];
    r=0;
    for(int i=2;i<=n;i++){
        if(dis(a[i],c)<r+eps) continue;
        c=gao2(i,r);
    }
    return c;
}

int main(){
#ifdef DEBUG
    freopen("in","r",stdin);
#endif
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lf%lf",&a[i].x,&a[i].y);
    scanf("%lf%lf",&rot,&scale);
    rot=rot*M_PI/180.;
    for(int i=1;i<=n;i++) a[i]=pre_gao(a[i]);
    random_shuffle(a+1,a+n+1);
    double res;
    gao1(res);
    printf("%.3lf\n",res);
}