做题回顾:用到海伦公式,还有注意数据类型,最好统一

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));//三角形面积,海伦公式

r=a*b*c/(4*s);//这是外接圆的半径

/*

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

*/

#include<iostream>//输入分别为三个点的坐标(x1,y1),(x2,y2),(x3,y3)

#include<cstdio>//利用海伦公式

#include<cstdlib>

#include<cmath>

#define PI 3.141592653589793

using namespace std;

int main()

{

double x1,x2,x3,y1,y2,y3;

double a,b,c,s,p,r,rt;

while(cin>>x1>>y1>>x2>>y2>>x3>>y3)//如果输入格式没有要求说明什么停止的,就这样输入

{

a=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));

b=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));

c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));//三角形面积,海伦公式

r=a*b*c/(4*s);

rt=2*PI*r;

printf("%.2lf\n",rt);

}

return 0;

}

POJ 2242 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. F - The Circumference of the Circle

    Description To calculate the circumference of a circle seems to be an easy task - provided you know ...

  3. poj 2242(已知三点求外接圆周长)

    The Circumference of the Circle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8310   ...

  4. ZOJ Problem Set - 1090——The Circumference of the Circle

      ZOJ Problem Set - 1090 The Circumference of the Circle Time Limit: 2 Seconds      Memory Limit: 65 ...

  5. POJ 2986 A Triangle and a Circle(三角形和圆形求交)

    Description Given one triangle and one circle in the plane. Your task is to calculate the common are ...

  6. ZOJ 1090 The Circumference of the Circle

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

  7. POJ 2986 A Triangle and a Circle 圆与三角形的公共面积

    计算几何模板 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h& ...

  8. POJ2242 The Circumference of the Circle(几何)

    题目链接. 题目大意: 给定三个点,即一个任意三角形,求外接圆的周长. 分析: 外接圆的半径可以通过公式求得(2*r = a/sinA = b/sinB = c/sinC),然后直接求周长. 注意: ...

  9. 【POJ2242】The Circumference of the Circle(初等几何)

    已知三点坐标,算圆面积. 使用初等几何知识,根据海伦公式s = sqrt(p(p - a)(p - b)(p - c)) 和 外接圆直径 d = a * b * c / (2s) 来直接计算. #in ...

随机推荐

  1. Github使用教程详解

    官方网站:http://git-scm.com Git是目前世界上最先进的分布式版本控制系统(没有之一). Git有什么特点?简单来说就是:高端大气上档次! 一.Git安装 在Linux上安装Git ...

  2. TeeChart取消3D

    tChart1.Aspect.View3D = false;//此属性默认是true 3d的效果 2d平面的效果 题外话,在使用控件的时候,需要注意: 在TChart控件上增加Series,   se ...

  3. C语言优先级

    条件1 && 条件2,如果条件1为假,则条件2语句不执行,因为能判断该表达式为假 条件1 || 条件2,如果条件1为真,则条件2语句不执行,因为能判断该表达式为真 优先级 运算符 名称 ...

  4. python闭包closure

    在讨论闭包之前,先总结一下python的命名空间namespace,一般的语言都是通过namespace来识别名字标识,无论是变量,对象,函数等等.python划分3个名字空间层次,local:局部, ...

  5. Ubuntu 14.04 定时任务

    如何在Ubuntu上启动一个定时任务,使得可以定时删除机器上的日志 首先, #查看cron状态 service cron status   如果提示没有安装 #安装cron服务 apt-get ins ...

  6. Window下的git配置文件在哪里【图文】

    来源:https://jingyan.baidu.com/article/870c6fc3589f22b03fe4be95.html 第一次使用码云建仓库总是提示各种错误,遂,从头在学一遍git,改篇 ...

  7. SSD论文理解

    SSD论文贡献: 1. 引入了一种单阶段的检测器,比以前的算法YOLO更准更快,并没有使用RPN和Pooling操作: 2. 使用一个小的卷积滤波器应用在不同的feature map层从而预测BB的类 ...

  8. Codeforces 294D - Shaass and Painter Robot

    294D - Shaass and Painter Robot 思路: 可以用数学归纳法证明一个结论:整个棋盘黑白相间当且仅当边缘黑白相间. 分奇偶讨论又可得出边缘黑色格个数为n+m-2 这样就可以暴 ...

  9. Python -- Scrapy 架构概览

    架构概览 本文档介绍了Scrapy架构及其组件之间的交互. 概述 接下来的图表展现了Scrapy的架构,包括组件及在系统中发生的数据流的概览(绿色箭头所示). 下面对每个组件都做了简单介绍,并给出了详 ...

  10. box-shadow四周都有阴影

    <style> .shadow{ -webkit-box-shadow: #666 0px 0px 10px; -moz-box-shadow: #666 0px 0px 10px; bo ...