题意:
给出3个点,确定一个正三角形,每个三角形的顶点一一对应一个给出的点,使对应的最大距离最小。

题解:

官方的

给出最优解的样子

 

代码:

#include<bits/stdc++.h>
#define N 1010
#define INF 0x3f3f3f3f
#define eps 1e-10
#define pi acos(-1.0)
#define mod 998244353
#define LL long long
#define pb push_back
#define cl clear
#define si size
#define lb lower_bound
#define ub upper_bound
#define mem(x) memset(x,0,sizeof x)
#define sc(x) scanf("%d",&x)
#define scc(x,y) scanf("%d%d",&x,&y)
#define sccc(x,y,z) scanf("%d%d%d",&x,&y,&z)
using namespace std;

struct Point
{
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){};

    friend Point operator - (Point a,Point b)
    {
        return Point(a.x-b.x,a.y-b.y);
    }
    friend Point operator + (Point a,Point b)
    {
        return Point(a.x+b.x,a.y+b.y);
    }
    friend Point operator * (Point a,double p)
    {
        return Point(a.x*cos(p)-a.y*sin(p),a.x*sin(p)+a.y*cos(p));
    }
    double dis ()
    {
        return sqrt(x*x+y*y);
    }
}a[4],t;

int main()
{
    int T,tt=0;
    sc(T);
    while(T--)
    {
        for (int i=0;i<3;i++) cin>>a[i].x>>a[i].y;
        t=(a[1]-a[2])*(pi/3)+a[2]-a[0];
        double ans=t.dis();
        t=(a[2]-a[1])*(pi/3)+a[1]-a[0];
        ans=min(ans,t.dis());
        printf("Case #%d: %.7f\n", ++tt,ans/3);
    }
}