博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cf------(round)#1 C. Ancient Berland Circus(几何)
阅读量:6701 次
发布时间:2019-06-25

本文共 2245 字,大约阅读时间需要 7 分钟。

C. Ancient Berland Circus
time limit per test
2 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.

In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a special pillar, and the rope strung between the pillars marked the arena edges.

Recently the scientists from Berland have discovered the remains of the ancient circus arena. They found only three pillars, the others were destroyed by the time.

You are given the coordinates of these three pillars. Find out what is the smallest area that the arena could have.

Input

The input file consists of three lines, each of them contains a pair of numbers –– coordinates of the pillar. Any coordinate doesn't exceed 1000 by absolute value, and is given with at most six digits after decimal point.

Output

Output the smallest possible area of the ancient arena. This number should be accurate to at least 6 digits after the decimal point. It's guaranteed that the number of angles in the optimal polygon is not larger than 100.

Sample test(s)
Input
0.000000 0.000000 1.000000 1.000000 0.000000 1.000000
Output
1.00000000 这道题的题意是: 以一个场地遗迹,呈现多边形,但是不知道具体是几边形,只知道他的三个点,求能包含这三个点的最小多边形的面积:  对于这样的题目: 思路为:   先求出他的外接圆,得到外接圆的半径rr.   (1外接圆的求法: {     (1) 有给定的坐标我们不难求出三条边的边长,rea,reb,rec;     (2) 又海伦公式得到三角形的面积: 周长cc=(rea+reb+rec)/2.0 面积等于: ss=sqrt(cc*(cc-rea)*(cc-reb)*(cc-rec));     (3) rr=rea*reb*rec/(4*ss);  //证明就不详细说了 } 得到外接园的半径之后:    我们再来求出每一条边对应的圆心角a,b,c;    求出a,b,c圆心角的最大公约数st; 这样我们就可以知道他是边数: 2*pi/st; 所以得到最小单位的三角形的面积为Area=rr*rr*sin(st)/2; 总面积只需再剩上他的边数就可以得到..... 代码如下:
1 #include
2 #include
3 #include
4 using namespace std; 5 const double PI = 3.1415926535; 6 const double esp=0.01; 7 struct node{ 8 double x,y; 9 //求两点之间的长度10 double solen(node a){11 return sqrt((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y));12 }13 };14 double dgcd(double a,double b) //最小公倍数15 {16 if(a
View Code

 

转载地址:http://wngoo.baihongyu.com/

你可能感兴趣的文章
VS2017 启动调试报错无法启动程序 当前状态中非法
查看>>
DevExpress Chart空间Y轴归一化(线性归一化函数)
查看>>
【Foreign】采蘑菇 [点分治]
查看>>
运用java 多线程模拟火车售票。。。。
查看>>
iOS开发之普通网络异步请求与文件下载方法
查看>>
添加文字和水印
查看>>
LUA ipairs遍历的问题
查看>>
字符驱动之按键(四:poll机制)
查看>>
现在有一个整数数组,已知一个数出现的次数超过了一半,请用O(n)的复杂度的算法找出这个数...
查看>>
山区建小学
查看>>
[javascript|基本概念|Number]学习笔记
查看>>
JSP EL表达式使用
查看>>
连接SQL Server数据库
查看>>
JAVA_Thread_deadlock
查看>>
中小企业网络安全提升
查看>>
[ZJOI2010]贪吃的老鼠
查看>>
爆栈的处理方法
查看>>
大院大所合作对接会7天倒计时!亮点抢先看
查看>>
[已授权] 互联网定位技术小谈
查看>>
Oracle执行计划解释
查看>>