ZOJ Problem Set - 1090
The Circumference of the Circle

Time Limit: 2 Seconds      Memory Limit: 65536 KB

To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't?

You are given the cartesian coordinates of three non-collinear points in the plane.
Your job is to calculate the circumference of the unique circle that
intersects all three points.

Input Specification

The input file will contain one or more test cases. Each test case consists
of one line containing six real numbers x1,y1,
x2,y2,x3,y3
,
representing the coordinates of the three points.
The diameter of the circle determined by the three points will never exceed
a million. Input is terminated by end of file.

Output Specification

For each test case, print one line containing one real number telling
the circumference of the circle determined by the three points.
The circumference is to be printed accurately rounded to two decimals.
The value of pi is approximately 3.141592653589793.

Sample Input

0.0 -0.5 0.5 0.0 0.0 0.5
0.0 0.0 0.0 1.0 1.0 1.0
5.0 5.0 5.0 7.0 4.0 6.0
0.0 0.0 -1.0 7.0 7.0 7.0
50.0 50.0 50.0 70.0 40.0 60.0
0.0 0.0 10.0 0.0 20.0 1.0
0.0 -500000.0 500000.0 0.0 0.0 500000.0

Sample Output

3.14
4.44
6.28
31.42
62.83
632.24
3141592.65

Source: University of Ulm Local Contest 1996

Submit

Status

 #include<bits/stdc++.h>
#define pi 3.141592653589793 using namespace std; double len(double a,double b,double c,double d)
{
return sqrt((a-b)*(a-b)+(c-d)*(c-d));
} int main()
{
double x1,x2,x3,y1,y2,y3;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3)
{
//求内接三角形的每一个边
double a=len(x1,x2,y1,y2),b=len(x1,x3,y1,y3),c=len(x2,x3,y2,y3);
//求2R=a/sinA 因为不知道sinA 所以先求cosA 那么就是cosA = b^2-c^2/2bc 然后1-cosA的平方=sinA的平方
double cosa=(b*b+c*c-a*a)/(*b*c);
double sina=sqrt(-cosa*cosa);
double d=a/sina;
printf("%.2f\n",pi*d);
}
return ;
}

ZOJ Problem Set - 1090——The Circumference of the Circle的更多相关文章

  1. poj 1090:The Circumference of the Circle(计算几何,求三角形外心)

    The Circumference of the Circle Time Limit: 2 Seconds      Memory Limit: 65536 KB To calculate the c ...

  2. ZOJ 1090 The Circumference of the Circle

    原题链接 题目大意:已知三角形的三个顶点坐标,求其外接圆的周长. 解法:刚看到这道题时,马上拿出草稿纸画图,想推导出重心坐标,然后求出半径,再求周长.可是这个过程太复杂了,写到一半就没有兴致了,还是求 ...

  3. ZOJ Problem Set - 1394 Polar Explorer

    这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...

  4. ZOJ Problem Set - 1025解题报告

    ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...

  5. ZOJ Problem Set - 3829Known Notation(贪心)

    ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...

  6. ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】

    称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...

  7. ZOJ Problem Set - 3593 拓展欧几里得 数学

    ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...

  8. ZOJ Problem Set - 2297 Survival 【状压dp】

    题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...

  9. ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】

    题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...

随机推荐

  1. MUI - 封装localStorage与plus.storage

    MUI - 封装localStorage与plus.storage 2.0版本 在使用plus.storage频繁地存取数据时,可以感觉到明显的卡顿,而且很耗内存, 在切换到localstorage时 ...

  2. 2019-10-22-win7-无法启动-WPF-程序-D3Dcompiler_47.dll-丢失

    title author date CreateTime categories win7 无法启动 WPF 程序 D3Dcompiler_47.dll 丢失 lindexi 2019-10-22 18 ...

  3. @uoj - 435@ 【集训队作业2018】Simple Tree

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 有一棵有根树,根为 1,点有点权. 现在有 m 次操作,操作有 ...

  4. Flask学习之二 模板

    继续学习flask 本部分Miguel Grinberg教程的翻译地址:http://www.pythondoc.com/flask-mega-tutorial/templates.html 英文原文 ...

  5. 5、nginx配置

    1.安装 sudo apt-get install nginx 2.启用 sudo service nginx start 3.若要将 Nginx 配置为转发请求向 ASP.NET Core 应用程序 ...

  6. adblock自定义规则

    click.admaster.cn/* cm.baidu.com/* cm.pos.baidu.com/* cpro.baidu.com/* cpro.baidustatic.com/* dup.ba ...

  7. oracle 用表连接替换EXISTS

    通常来说 , 采用表连接的方式比EXISTS更有效率 SELECT ENAME FROM EMP E WHERE EXISTS (SELECT ‘X’ FROM DEPT WHERE DEPT_NO ...

  8. SuperSocket 服务管理器 (ServerManager)

    什么 SuperSocket 服务管理器? SuperSocket 服务管理器是一个让你能够在客户中用图形化界面来管理和监控你的SuperSocket服务器程序的组件. 在服务器端配置服务器管理器 事 ...

  9. laravel 中使用tinker注入数据到数据库

  10. Porject Euler Problem 6-Sum square difference

    我的做法就是暴力,1+...+n 用前n项和公式就行 1^2+2^2+....+n^2就暴力了 做完后在讨论版发现两个有趣的东西. 一个是 (1+2+3+...+n)^2=(1^3)+(2^3)+(3 ...