HDU3264 Open-air shopping malls

http://acm.hdu.edu.cn/showproblem.php?pid=3264


09宁波

计算几何。计算半个圆面积是需要推一下。


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
const double eps=1e-6;
const long long INF=(1<<30)-1;
const double pi=3.1415926535897932384626433;

#define N 25
#define M 1000000000

struct circ
{
    double x,y,r;
}c[N];

int n;

double dist(struct circ p,struct circ q)
{
    return sqrt((p.x-q.x)*(p.x-q.x)+(p.y-q.y)*(p.y-q.y));
}

double arccos(double s)
{
    if (fabs(s-1)eps)
    {
        R=(s+t)/2.0;
        double thi=arccos( (d*d+r*r-R*R)/(2*d*r) );
        double thi2=arccos( (d*d+R*R-r*r)/(2*d*R) );
        ss=r*r*thi+R*R*thi2-d*r*sin(thi);

        //cout<sc) t=R;
        else s=R;
    }

    return R;
}

int main()
{
    //freopen("a","r",stdin);

    int T,kk,i,j,x,y,r1,k;
    scanf("%d",&T);
    for (kk=1;kk<=T;kk++)
    {
        scanf("%d",&n);
        for (i=1;i<=n;i++)
        {
            scanf("%d%d%d",&x,&y,&r1);
            c[i].x=x;
            c[i].y=y;
            c[i].r=r1;
        }

        if (n==1)
        {
            printf("%.4f\n",c[1].r/sqrt(2));
            continue;
        }

        double min=100000,d,r;
        for (i=1;i<=n;i++)
        {
            double max=-1;

            for (j=1;j<=n;j++)
            if (j!=i)
            {
                double ans=disR(i,j);
                if (ans>max) max=ans;
            }

            if (max


你可能感兴趣的:(亚洲赛区原题,HDOJ)