http://acm.hdu.edu.cn/showproblem.php?pid=1374

已知三点坐标,求三点确定的圆的周长

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std ;
//由正弦定理 sin90°/d=sinA/a 既d=a/sinA
//s=1/2(bcsinA) 既sinA=2s/bc
//由海伦公式 s=sqrt(p(p-a)(p-b)(p-c)),p=(a+b+c)/2
#define PI 3.141592653589793
int main()
{
double x1,y1,x2,y2,x3,y3 ;
while(~scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3))
{
double a=sqrt(pow(x1-x2,)+pow(y1-y2,)) ;
double b=sqrt(pow(x2-x3,)+pow(y2-y3,)) ;
double c=sqrt(pow(x1-x3,)+pow(y1-y3,)) ;
double p=(a+b+c)/ ;
double s=sqrt(p*(p-a)*(p-b)*(p-c)) ;
double d=a/(*s/(b*c)) ;
printf("%.2lf\n",PI*d) ;
}
return ;
}

用向量算面积精确度更高

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std ;
//由正弦定理 sin90°/d=sinA/a 既d=a/sinA
//s=1/2(bcsinA) 既sinA=2s/bc
//由多边形面积公式算得s
#define PI 3.141592653589793
int main()
{
double x1,y1,x2,y2,x3,y3 ;
while(~scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3))
{
double a=sqrt(pow(x1-x2,)+pow(y1-y2,)) ;
double b=sqrt(pow(x2-x3,)+pow(y2-y3,)) ;
double c=sqrt(pow(x1-x3,)+pow(y1-y3,)) ;
double _2s=fabs(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3) ;
double d=a/(_2s/(b*c)) ;
printf("%.2lf\n",PI*d) ;
}
return ;
}

HDU 1374的更多相关文章

  1. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  2. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  3. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. JS时间和字符串的相互转换 Date+String

    1.js字符串转换成时间 1.1方法一:输入的时间格式为yyyy-MM-dd function convertDateFromString(dateString) { if (dateString) ...

  2. [HAOI2015]T2

    [题目描述] 有一棵点数为N的树,以点1为根,且树点有边权.然后有M个操作,分为三种: 操作1:把某个节点x的点权增加a. 操作2:把某个节点x为根的子树中所有点的点权都增加a. 操作3:询问某个节点 ...

  3. 简单的dos命令

    cd ..   进入上一层目录cd /..   进入当前盘所有根目录d:  进入d盘dir  查看下一级目录d:>d:\abc.txt 新建一个文档hostname   主机名SET 查看环境变 ...

  4. springboot集成shiro 前后端分离 统一处理shiro异常

    在前后端分离的情况下,shiro一些权限异常处理会返回401之类的结果,这种结果不好统一管理.我们希望的结果是统一管理,所有情况都受我们控制 就算权限验证失败,我们也希望返回200,并且返回我们定义的 ...

  5. python print和strip

    在使用这两个模块时犯过错误,总结如下: 1.print print在打印时会自动加上换行,例如: >>> for i in xrange(1,5): ... print i ... ...

  6. Lucene 初步 之 HelloWorld

    万恶的源头 HelloWorld 要完成lucene 的配置 需要几个jar包 (如果需要可以留言我私发) 创建索引API分析: 1. Directory: 类代表一个Lucene索引的位置,FSDi ...

  7. quartz动态job工具类 serviceh注入问题

    package com.heyi.yanglao.common.job.util; import cn.hutool.core.date.DateUtil; import lombok.extern. ...

  8. linux下网卡配置vlan

      yum install vconfig -y  modprobe 8021qvconfig add eth0 900 ifconfig eth0.900 172.16.90.57/24 up    ...

  9. 036——VUE中表单控件处理之动态绑定文章的属性的处理方法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. QMainWindow: No such file or directory 问题的解决方法

    这种问题往往是由于QT4的程序转换到QT5所导致的,在.pro文件中加上一句 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 就可以解决问题