题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3716

来源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26644#problem/A

Ribbon Gymnastics


Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge


Robert is a gymnastics coach. Unfortunately, he got four gymnastics beginners to attend the coming competition. Since the competition has a nice award, Robert will make all his effort
to win the competition.

One performance requires that each of the four player should take a ribbon and rotate herself, and assume the ribbons will then straighten out. Since Robert's four players are beginners,
Robert cannot control the actual rotating speeds of four players during the competition. And when two ribbons touch, they may wind, which will cause players felling down. For safety, Robert should avoid this. Four distinct points will be given as xi yi before
the competition begins. Players should stand at those points when rotating.

The longer the ribbons are, the more bonus Robert will gain. After knowing the four points Robert can choose ribbons and points for each player. The length of each ribbon should be positive.
So help Robert to find the maximal total lengths of the four ribbons.

Input

There will be multiple test cases.Please process to the end of input.

Each test case contains four lines.

Each line contains two integers xi (-10^8≤xi≤10^8) and yi (-10^8≤yi≤10^8).

Output

Output the total maximal sum of the lengths of the four ribbons. Answer having an absolute or relative error less than 1e-6 will be accepted.

Sample Input

0 0
0 3
4 0
4 3

Sample Output

6.00000000

Author: YANG, Jueji

Contest: ZOJ Monthly, June 2013

题意:给你四个点,四个人在四个点上舞动丝带,各条丝带不能相遇,求四人最大的丝带总长度。

思路:开始比赛时想的是以这四个点画圆求四个圆尽量相切,求最大的半径和。

   先找出两两点中的最短的一条线,由此必然确定了两个相切的圆,然后再上下移动,慢慢的确定另外的圆。

一直没想到怎么确定,后来就放弃了。。。

刚刚搜了下题解,应该这个是正解,也是圆相切的http://blog.csdn.net/u010638776/article/details/9218995

刚刚问了下KB神,他给了个传说中世界冠军 YY的思路

迅速秒过啊,求知道的大神给个证明Orz

A Accepted 180 KB 0 ms C++ (g++ 4.4.5) 729 B 2013-07-20 17:27:52
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std; struct Point{
double x;
double y;
}p[5]; double dist(Point a, Point b)
{
return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
} int main()
{
while(scanf("%lf%lf", &p[0].x, &p[0].y) != EOF)
{
for(int i = 1; i < 4; i++)
{
scanf("%lf%lf", &p[i].x, &p[i].y);
}
double d1 = dist(p[0], p[1]);
double d2 = dist(p[1], p[2]);
double d3 = dist(p[2], p[3]);
double d4 = dist(p[0], p[3]);
double d5 = dist(p[0], p[2]);
double d6 = dist(p[1], p[3]); double ans = min(d1+d3, min(d4+d2, d5+d6));
printf("%.8lf\n", ans);
}
return 0;
}

zoj 3716 Ribbon Gymnastics【神奇的计算几何】的更多相关文章

  1. zoj 3716 Ribbon Gymnastics (思维数学题)

    题目 以四个顶点为圆心画圆,圆面积不能重合,求四个圆的直径和最大是多少. #define _CRT_SECURE_NO_WARNINGS #include<string.h> #inclu ...

  2. Ribbon Gymnastics

    Robert is a gymnastics coach. Unfortunately, he got four gymnastics beginners to attend the coming c ...

  3. zoj 3716

    题目给我们四个点,要求我们以这四个点为圆心,形成四个相切的圆: 求他们的半径和: 首先我们从他们中间选出三个点,以这三个点为圆心的三个圆最大可以两两互相相切: 证明:假设这三个圆的半径分别为a,b,c ...

  4. [置顶] 2013_CSUST暑假训练总结

    2013-7-19 shu 新生训练赛:母函数[转换成了背包做的] shuacm 题目:http://acm.hdu.edu.cn/diy/contest_show.php?cid=20083总结:h ...

  5. 130804组队练习赛ZOJ校赛

    A.Ribbon Gymnastics 题目要求四个点作圆,且圆与圆之间不能相交的半径之和的最大值.我当时想法很简单,只要两圆相切,它们的半径之和一定最大,但是要保证不能相交的话就只能取两两个点间距离 ...

  6. 「Luogu P3680 凸轮廓线」

    一道神奇的计算几何题 前置芝士 正三角形,正方形,圆:什么,您都会,那真是太好了. 三角函数的运用:因为我不是很想在这一块写太多,具体可以自行百度. 推导公式 对于一串是圆和正方形开头和结尾时是十分好 ...

  7. ZOJ 3157 Weapon --计算几何+树状数组

    题意:给一些直线,问这些直线在直线x=L,x=R之间有多少个交点. 讲解见此文:http://blog.sina.com.cn/s/blog_778e7c6e0100q64a.html 首先将直线分别 ...

  8. ●BZOJ 1006 [HNOI2008]神奇的国度(弦图最小染色数)○ZOJ 1015 Fishing Net

    ●赘述题目 给出一张弦图,求其最小染色数. ●题解 网上的唯一“文献”:<弦图与区间图>(cdq),可以学习学习.(有的看不懂) 摘录几个解决改题所需的知识点: ●子图和诱导子图(一定要弄 ...

  9. ZOJ 3203 Light Bulb (三分+计算几何)

    B - Light Bulb Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit ...

随机推荐

  1. SSO单点登录系列6:cas单点登录防止登出退出后刷新后退ticket失效报500错

    这个问题之前就发现过,最近有几个哥们一直在问我这个怎么搞,我手上在做另一个项目,cas就暂时搁浅了几周.现在我们来一起改一下你的应用(client2/3)的web.xml来解决这个2b问题,首先看下错 ...

  2. Windows为什么双击打开‘我的电脑’, 没有了‘前进’‘ 后退’‘向上’等按钮?

    如图所示   点击查看 工具栏 标准按钮即可   左侧的数值虚线可以拖动到任意,还可以添加按钮如搜索,删除,复制,剪切等

  3. PHP实现查看邮件是否被阅读

      <? //当你在发送邮件时,你或许很想知道该邮件是否被对方已阅读.这里有段非常有趣的代码片段能够显示对方IP地址记录阅读//的实际日期和时间. error_reporting(0); Hea ...

  4. css 中 important 的用法

      css 中 important 的如何使用?  important对 一个良好(或者是标准)的浏览器来说,不仅仅是从顺序上提升代码的优先级,还可以用来提升class的优先级(比如firefox), ...

  5. ckeditor编辑时 回车 生成一个段落p、解决首行缩进问题

    使用ckeditor编辑器时,会自己主动加入上的标签,按回车也会自己主动加入上同样的标签 查看ckeditor编辑器源代码时会看到,点击回车显示的<p> </p> static ...

  6. Java注解基本介绍

    注解(Annotation),又称元数据(MetaData),提供了一种在代码中添加信息的形式化的方法,将元数据和源代码结合在一起. 1. 外部配置文件如XML存在的问题: 代码复杂度较高,需要编写很 ...

  7. 【Hadoop基础教程】1、Hadoop之服务器基础环境搭建(转)

    本blog以K-Master服务器基础环境配置为例分别演示用户配置.sudo权限配置.网路配置.关闭防火墙.安装JDK工具等.用户需参照以下步骤完成KVMSlave1~KVMSlave3服务器的基础环 ...

  8. IDC机房带宽突然暴涨问题!

    IDC机房带宽突然暴涨问题! 1[提出问题] [实际案例一] 凌晨3:00点某公司(网站业务)的一个IDC机房带宽流量突然从平时高峰期150M猛增至1000M,如下图: 该故障的影响:直接导致数百台服 ...

  9. Hdu 5288 OO’s Sequence 2015多小联赛A题

    OO's Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  10. Hadoop2.6.0版本MapReudce示例之WordCount(二)

    继<Hadoop2.6.0版本MapReudce示例之WordCount(一)>之后,我们继续看MapReduce的WordCount示例,看看如何监控作业运行或查看历史记录,以及作业运行 ...