Ribbon Gymnastics
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的更多相关文章
- zoj 3716 Ribbon Gymnastics【神奇的计算几何】
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3716 来源:http://acm.hust.edu.cn/vjudg ...
- zoj 3716 Ribbon Gymnastics (思维数学题)
题目 以四个顶点为圆心画圆,圆面积不能重合,求四个圆的直径和最大是多少. #define _CRT_SECURE_NO_WARNINGS #include<string.h> #inclu ...
- 130804组队练习赛ZOJ校赛
A.Ribbon Gymnastics 题目要求四个点作圆,且圆与圆之间不能相交的半径之和的最大值.我当时想法很简单,只要两圆相切,它们的半径之和一定最大,但是要保证不能相交的话就只能取两两个点间距离 ...
- [置顶] 2013_CSUST暑假训练总结
2013-7-19 shu 新生训练赛:母函数[转换成了背包做的] shuacm 题目:http://acm.hdu.edu.cn/diy/contest_show.php?cid=20083总结:h ...
- Devexpress Ribbon Add Logo
一直在网上找类似的效果.在Devpexress控件里面的这个是一个Demo的.没法查看源代码.也不知道怎么写的.所以就在网上搜索了半天的. 终于找到类似的解决办法. 可以使用重绘制的办法的来解决. [ ...
- 问题解决——MFC Ribbon 响应函数 错乱 执行其他函数
==================================声明================================== 本文原创,转载在正文中显要的注明作者和出处,并保证文章的完 ...
- 问题解决——MFC Ribbon 添加图标
=================================版权声明================================= 版权声明:本文为博主原创文章 未经许可不得转载 请通过右 ...
- Office2013插件开发Outlook篇(2)-- Ribbon
一.获取当前实例 在Ribbon1的任何方法中调用如下代码,可获取当前实例. 如: Application application = new Application(); var list = ap ...
- WPF中Ribbon控件的使用
这篇博客将分享如何在WPF程序中使用Ribbon控件.Ribbon可以很大的提高软件的便捷性. 上面截图使Outlook 2010的界面,在Home标签页中,将所属的Menu都平铺的布局,非常容易的可 ...
随机推荐
- NDK 的helloworld步奏
1. helloworld.c #include <string.h> #include <jni.h> /* * Class: com_example_ndk_NativeH ...
- mysql各种日志对应的配置项
01.error_log --log-error=<file_name> 02.general_log --general-log-file=<file_name> --gen ...
- 混合使用Azure LB和ILB访问相同web服务(3)
接下来我们来配置Azure Load balancer,就是面向公网的负载均衡器: 1.在该测试中,为了保持内网访问和外网访问一样的体验,本地端口和public端口和ILB一样,同样是80: PS C ...
- JVM的生命周期——JVM之二
一.首先分析两个概念 JVM实例和JVM执行引擎实例 (1)JVM实例对应了一个独立运行的java程序——进程级别 一个运行时的Java虚拟机(JVM)负责运行一个Java程序. 当启动一个Java程 ...
- NFC的安全性
NFC近距离无线技术具有快捷.易用.安全等特性,其中安全是支付行业最关心的特性. 众所周知传统磁条银行卡的账号信息,是记录在磁条中,当进行刷卡交易时,POS机将交易金额,银行卡中的账号信息以及用户输入 ...
- poj 3233 Matrix Power Series
A为一个n*n的矩阵,求A+A^2+A^3+...+A^n Sk = A + A2 + A3 + - + Ak =(1+Ak/2)*(A + A2 + A3 + - + Ak/2 )+{ ...
- hdu 4775 Infinite Go(暴力)
pid=4775" target="_blank" style="">题目链接:hdu 4775 Infinite Go 题目大意:两个人下围棋 ...
- 【类克鲁斯卡尔做法+枚举最小边】【HDU1598】【find the most comfortable road】
题意: 给你一个图,有边权,K个询问:u到v 的路径中 边权最大值-边权最小值的最小值是多少 http://acm.hdu.edu.cn/showproblem.php?pid=1598 题解( ...
- C#核编之内建数据类型
这个随笔中的重点之一是说明:C#中所提供的关键字都是相应系统类型的简化符号(如int是System.Int32类型的简化符号) 一.内建数据类型与层级结构 所有的C#内建数据类型都支持默认的构造函数, ...
- 百度编辑器ueditor 在vs2008中的使用方法
个人觉得百度编辑器ueditor还是不错的,虽然出生的时间比较短,但某些方面相比其它富文本编辑器更优秀,免费.可定制等等. 由于在官方下载的ueditor包是在vs2012下开发的,可以在vs2010 ...