zoj 3716 Ribbon Gymnastics【神奇的计算几何】
题目: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【神奇的计算几何】的更多相关文章
- zoj 3716 Ribbon Gymnastics (思维数学题)
题目 以四个顶点为圆心画圆,圆面积不能重合,求四个圆的直径和最大是多少. #define _CRT_SECURE_NO_WARNINGS #include<string.h> #inclu ...
- Ribbon Gymnastics
Robert is a gymnastics coach. Unfortunately, he got four gymnastics beginners to attend the coming c ...
- zoj 3716
题目给我们四个点,要求我们以这四个点为圆心,形成四个相切的圆: 求他们的半径和: 首先我们从他们中间选出三个点,以这三个点为圆心的三个圆最大可以两两互相相切: 证明:假设这三个圆的半径分别为a,b,c ...
- [置顶] 2013_CSUST暑假训练总结
2013-7-19 shu 新生训练赛:母函数[转换成了背包做的] shuacm 题目:http://acm.hdu.edu.cn/diy/contest_show.php?cid=20083总结:h ...
- 130804组队练习赛ZOJ校赛
A.Ribbon Gymnastics 题目要求四个点作圆,且圆与圆之间不能相交的半径之和的最大值.我当时想法很简单,只要两圆相切,它们的半径之和一定最大,但是要保证不能相交的话就只能取两两个点间距离 ...
- 「Luogu P3680 凸轮廓线」
一道神奇的计算几何题 前置芝士 正三角形,正方形,圆:什么,您都会,那真是太好了. 三角函数的运用:因为我不是很想在这一块写太多,具体可以自行百度. 推导公式 对于一串是圆和正方形开头和结尾时是十分好 ...
- ZOJ 3157 Weapon --计算几何+树状数组
题意:给一些直线,问这些直线在直线x=L,x=R之间有多少个交点. 讲解见此文:http://blog.sina.com.cn/s/blog_778e7c6e0100q64a.html 首先将直线分别 ...
- ●BZOJ 1006 [HNOI2008]神奇的国度(弦图最小染色数)○ZOJ 1015 Fishing Net
●赘述题目 给出一张弦图,求其最小染色数. ●题解 网上的唯一“文献”:<弦图与区间图>(cdq),可以学习学习.(有的看不懂) 摘录几个解决改题所需的知识点: ●子图和诱导子图(一定要弄 ...
- ZOJ 3203 Light Bulb (三分+计算几何)
B - Light Bulb Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit ...
随机推荐
- 损失函数(loss function)
通常而言,损失函数由损失项(loss term)和正则项(regularization term)组成.发现一份不错的介绍资料: http://www.ics.uci.edu/~dramanan/te ...
- netty handle处理流程
server handlerAdded server channelRegistered server channelActive server read server channelInactive ...
- TestNG+ReportNG+IDEA+Git+Jenkins+surefire持续集成数据驱动dubbo接口测试
一.pom.xml增加testng相关配置 <!--添加插件 关联testNg.xml--><plugin> <groupId>org.apache.maven.p ...
- 福利来了,全国路网数据,poi数据
本人现有全国路网数据,POI数据,均为原始数据.无偏移,都已分类,如图所示.有意请联系(QQ204843224), 兴趣点包含: 餐饮.村庄.大厦.服务区.公安交警.购物.火车站.机场.加油站.交通. ...
- python中MySQLdb模块用法实例
篇文章主要介绍了python中MySQLdb模块用法,以实例形式详细讲述了MySQLdb模块针对MySQL数据库的各种常见操作方法,非常具有实用价值,需要的朋友可以参考下 本文实例讲述了python中 ...
- 读jQuery源码之整体框架分析
读一个开源框架,大家最想学到的就是设计的思想和实现的技巧.最近读jQuery源码,记下我对大师作品的理解和心得,跟大家分享,权当抛砖引玉. 先附上jQuery的代码结构. (function(){ / ...
- 为什么 Linux 的 htop 命令完胜 top 命令
在 Linux 系统中,top 命令用来显示系统中正在运行的进程的实时状态,它显示了一些非常有用的信息,比如 CPU 利用情况.内存消耗情况,以及每个进程情况等.但是,你知道吗?还有另外一个命令行工具 ...
- CentOS 安装rz和sz
在虚机装了CentOS6.4版本,结果ssh上去后发现rz命令不能用.那只有自力更生了,其实很简单,如下: yum install lrzsz 如果本地没有包,需要编译安装了: cd /tmp wge ...
- ASP.NET基本对象介绍
ASP.NET能够成为一个庞大的软件体系,与它提供了大量的对象类库有很大的关系.这些类库中包含许多封装好的内置对象,开发人员可以直接使用这些对象的方法和属性,因此用较少的代码量就能轻松完成很多对象. ...
- 2010年imac从移动硬盘启动Win10
虽然是个程序员,但也爱折腾. 原WIN10不想折腾,虚拟机折腾大点的软件太卡,不能完全发挥硬件水平. 原材料(硬件):2010年imac一台,80G移动硬盘一块(个人组装,硬盘盒+3.5寸IDE硬盘) ...