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
 #include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std; struct Point
{
double x;
double y;
}p[]; 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[].x, &p[].y) != EOF)
{
for(int i = ; i < ; i++) scanf("%lf%lf", &p[i].x, &p[i].y);
double d1 = dist(p[], p[]);
double d2 = dist(p[], p[]);
double d3 = dist(p[], p[]);
double d4 = dist(p[], p[]);
double d5 = dist(p[], p[]);
double d6 = dist(p[], p[]); double ans = min(d1+d3, min(d4+d2, d5+d6));
printf("%.8lf\n", ans);
}
return ;
}

计算机几何

Ribbon Gymnastics的更多相关文章

  1. zoj 3716 Ribbon Gymnastics【神奇的计算几何】

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

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

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

  3. 130804组队练习赛ZOJ校赛

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

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

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

  5. Devexpress Ribbon Add Logo

    一直在网上找类似的效果.在Devpexress控件里面的这个是一个Demo的.没法查看源代码.也不知道怎么写的.所以就在网上搜索了半天的. 终于找到类似的解决办法. 可以使用重绘制的办法的来解决. [ ...

  6. 问题解决——MFC Ribbon 响应函数 错乱 执行其他函数

    ==================================声明================================== 本文原创,转载在正文中显要的注明作者和出处,并保证文章的完 ...

  7. 问题解决——MFC Ribbon 添加图标

    =================================版权声明================================= 版权声明:本文为博主原创文章 未经许可不得转载  请通过右 ...

  8. Office2013插件开发Outlook篇(2)-- Ribbon

    一.获取当前实例 在Ribbon1的任何方法中调用如下代码,可获取当前实例. 如: Application application = new Application(); var list = ap ...

  9. WPF中Ribbon控件的使用

    这篇博客将分享如何在WPF程序中使用Ribbon控件.Ribbon可以很大的提高软件的便捷性. 上面截图使Outlook 2010的界面,在Home标签页中,将所属的Menu都平铺的布局,非常容易的可 ...

随机推荐

  1. Words-specialty

    1-100   101-200   community n.社区; 共同体; 社会团体; [生态] 群落 overview n.概观; 总的看法; 回顾,复习 transforming vi.改变,使 ...

  2. alsa音频驱动科普第一课

    做linux音频编程对alsa应该不陌生. 但是对于刚接触这块技术的同学来说是一件困难的事情.原因在于:网上关于alsa的资料太少了,特别国内的资料更是大部分重复.对于初学者来说特别苦恼. 由于笔者经 ...

  3. webpack图片的路径与打包

    转的http://www.cnblogs.com/ghost-xyx/p/5812902.html 今天写 react遇到打包图片,之前都是通过url在css里,没遇到问题,今天在 react里直接用 ...

  4. Sql Server专题一:索引(中)

    写在前面的废话: 索引这个知识点,我前前后后不知道看了多少边,网上的文章五花八门,搞的我晕头转向,搞的牛逼点的就是测试索引带来的好处,还搞一大堆的测试数据出来,有意思吗?MS自己不会测试吗?这样的测试 ...

  5. android--graphics

    Color类 Constants |____BLACK, BLUE, CYAN Methods |____argb,rgb,alpha, red, green, blue |____parseColo ...

  6. Delphi 线程Timer (TThreadTimer)

    delphi 自带的Timer控件,使用方便,但它的 OnTimer 事件是在主线程中引发的. 如果在事件中执行较耗时的代码,会引起主界面假死.故实现一个线程的Timer就有必要了. TThreadT ...

  7. JavaEE Tutorials (26) - 批处理

    26.1批处理介绍391 26.1.1批处理作业中的步骤391 26.1.2并行处理392 26.1.3状态和判定元素392 26.1.4批处理框架功能39326.2Java EE中的批处理394 2 ...

  8. 获取ActiveX控件本身所在的路径 和 error PRJ0050

    一. CString   GetCurPath()     {     TCHAR       exeFullPath[MAX_PATH];     CString       strPath;    ...

  9. #include <boost/thread.hpp>

    在这个库最重要的一个类就是boost::thread,它是在boost/thread.hpp里定义的,用来创建一个新线程.它已经被纳入C++标准库中. 小结:新一代C++标准将线程库引入后,将简化多线 ...

  10. 使用工具来提升Android开发效率

    正所谓工欲善其事,必先利其器.学习并应用优秀的轮子,能够让我们跑的更快,走的更远.这里所指的工具是广义的,泛指能帮助我们开发的东西,或者能提高我们效率的东西,包含:开发工具.监測工具.第三方代码库等. ...