链接

枚举伞的圆心,最多只有20个,因为必须与某个现有的圆心重合。

然后再二分半径就可以了。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 25
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
struct point
{
double x,y;
double r,s;
point(double x=,double y=):x(x),y(y) {}
} p[N];
int n;
typedef point pointt;
pointt operator -(point a,point b)
{
return point(a.x-b.x,a.y-b.y);
}
int dcmp(double x)
{
if(fabs(x)<eps) return ;
return x<?-:;
}
double circle_area(point a,point b)
{
double s,d,t,t1;
d=sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
if(d>=a.r+b.r) s=;
else if(d<=fabs(a.r-b.r)) s=min(acos(-1.0)*a.r*a.r,acos(-1.0)*b.r*b.r);
else
{
t=(a.r*a.r+d*d-b.r*b.r)/2.0/d;
t1=sqrt(a.r*a.r-t*t);
s=-d*t1+a.r*a.r*acos(t/a.r)+b.r*b.r*acos((d-t)/b.r);
}
return s;
}
int cal(double mid,point pp)
{
int i;
double sum;
pp.r = mid;
for(i = ; i <= n ; i++)
{
sum = circle_area(pp,p[i]);
if(dcmp(sum-p[i].s/)<) return ;
}
//cout<<mid<<" "<<pp.x<<" "<<pp.y<<" "<<pp.r<<endl;
return ;
}
double solve(point pp)
{
double rig = ,lef = ,mid;
while(rig-lef>eps)
{
mid = (rig+lef)/;
if(cal(mid,pp))
rig = mid;
else lef = mid;
}
return rig;
}
int main()
{
int t,i;
cin>>t;
while(t--)
{
scanf("%d",&n);
for(i = ; i <= n ; i++)
{
scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].r);
p[i].s = pi*p[i].r*p[i].r;
}
double ans = INF;
for(i = ; i <= n ; i++)
{
ans = min(ans,solve(p[i]));
}
printf("%.4f\n",ans);
}
return ;
}

hdu3264Open-air shopping malls(二分)的更多相关文章

  1. Open-air shopping malls(二分半径,两元交面积)

    http://acm.hdu.edu.cn/showproblem.php?pid=3264 Open-air shopping malls Time Limit: 2000/1000 MS (Jav ...

  2. hdu 3264 09 宁波 现场 E - Open-air shopping malls 计算几何 二分 圆相交面积 难度:1

    Description The city of M is a famous shopping city and its open-air shopping malls are extremely at ...

  3. HDU 3264/POJ 3831 Open-air shopping malls(计算几何+二分)(2009 Asia Ningbo Regional)

    Description The city of M is a famous shopping city and its open-air shopping malls are extremely at ...

  4. hdu 3264 Open-air shopping malls(圆相交面积+二分)

    Open-air shopping malls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  5. POJ 3831 &amp; HDU 3264 Open-air shopping malls(几何)

    题目链接: POJ:id=3831" target="_blank">http://poj.org/problem?id=3831 HDU:http://acm.h ...

  6. UVALive - 6572 Shopping Malls floyd

    题目链接: http://acm.hust.edu.cn/vjudge/problem/48416 Shopping Malls Time Limit: 3000MS 问题描述 We want to ...

  7. [hdu 3264] Open-air shopping malls(二分+两圆相交面积)

    题目大意是:先给你一些圆,你可以任选这些圆中的一个圆点作圆,这个圆的要求是:你画完以后.这个圆要可以覆盖之前给出的每一个圆一半以上的面积,即覆盖1/2以上每一个圆的面积. 比如例子数据,选左边还是选右 ...

  8. HDU 3264 Open-air shopping malls ——(二分+圆交)

    纯粹是为了改进牛吃草里的两圆交模板= =. 代码如下: #include <stdio.h> #include <algorithm> #include <string. ...

  9. HDU 3264 Open-air shopping malls (计算几何-圆相交面积)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3264 题意:给你n个圆,坐标和半径,然后要在这n个圆的圆心画一个大圆,大圆与这n个圆相交的面积必须大于等 ...

随机推荐

  1. Git and GitHub

    1.GitHub 创建一个仓库 2.进入本地要管理的某个文件夹下,感觉目录的操作命令和linux里面差不多, $git init 此时该文件下就会多出一个.git的文件 3.进入要上传的仓库,右键gi ...

  2. JAVA中int、String的类型相互转换

    int -> String int i=12345;String s="";第一种方法:s=i+"";第二种方法:s=String.valueOf(i); ...

  3. JSONArray传值的使用小结

    今天使用了SpringMVC+mybatis传值.从controller中传到service中.可是由于版本问题参数中不能有大写和下划线,在service中只能用String 来接受json字符串.接 ...

  4. 使用jquery再次封装ajax

    $.fn.ajaxSend = function (type, url, postdata, onSuccess) { $.ajax({ async: false, url: url, type: t ...

  5. JS中的call()和apply()方法和bind()

    1.方法定义 call方法: 语法:call([thisObj[,arg1[, arg2[,   [,.argN]]]]]) 定义:调用一个对象的一个方法,以另一个对象替换当前对象. 说明: call ...

  6. MUI 个推

    个推 四种消息模板(透传消息模板.点击通知打开网页模板.点击通知打开应用模板.点击通知栏弹框下载模版) 三种推送方式(对单个用户推送接口 | 对指定用户列表推送接口 | 对指定应用群推接口) 四种消息 ...

  7. 【Java】聊聊常用的摘要算法,比如MD5

    摘要算法的特性 摘要算法的目的的将信息进行简单地摘要,将任意长的信息摘要成固定长的信息.比如MD5,将任意长的信息摘要成128位的摘要. 不可逆的,将报文摘要成一段信息后,无法通过摘要信息还原会报文. ...

  8. 在JSP页面显示九九乘法表

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  9. 【leetcode❤python】 20. Valid Parentheses

    #-*- coding: UTF-8 -*-#利用栈的思想#如果输入的左测扩则入栈,如果输入为右侧扩,判断其是否与当前栈顶配对,如果匹配则删除这一对,否则return False#'(', ')', ...

  10. acdream1197 Points In Cuboid(hash树状数组)

    题目链接:http://acdream.info/problem?pid=1197 题意:给出三维空间n个点,m个查询,每次查询某个立方体内的点的个数. 思路:按照一维排序,根据查询插入,其他两位用二 ...