题目链接

抄的外心模版。然后,输出认真一点。1Y。

 #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
#define eps 1e-8
struct point
{
double x,y;
};
struct line
{
point a,b;
};
point intersection(line u,line v)
{
point ret = u.a;
double t = ((u.a.x-v.a.x)*(v.a.y-v.b.y)-(u.a.y-v.a.y)*(v.a.x-v.b.x))
/((u.a.x-u.b.x)*(v.a.y-v.b.y)-(u.a.y-u.b.y)*(v.a.x-v.b.x));
ret.x += (u.b.x-u.a.x)*t;
ret.y += (u.b.y-u.a.y)*t;
return ret;
}
point circumcenter(point a,point b,point c)
{
line u,v;
u.a.x = (a.x+b.x)/;
u.a.y = (a.y+b.y)/;
u.b.x = u.a.x - a.y + b.y;
u.b.y = u.a.y + a.x - b.x;
v.a.x = (a.x+c.x)/;
v.a.y = (a.y+c.y)/;
v.b.x = v.a.x - a.y + c.y;
v.b.y = v.a.y + a.x - c.x;
return intersection(u,v);
}
double dis(point p1,point p2)
{
return sqrt((p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y));
}
int main()
{
point p1,p2,p3,cr;
double r,c,d,e;
while(scanf("%lf%lf",&p1.x,&p1.y)!=EOF)
{
scanf("%lf%lf",&p2.x,&p2.y);
scanf("%lf%lf",&p3.x,&p3.y);
cr = circumcenter(p1,p2,p3);
r = dis(cr,p1);
cr.x = -cr.x;
cr.y = -cr.y;
if(cr.x > -eps)
printf("(x + %.3f)^2",cr.x+eps);
else
printf("(x - %.3f)^2",-(cr.x+eps));
if(cr.y > -eps)
printf(" + (y + %.3lf)^2 = ",cr.y+eps);
else
printf(" + (y - %.3lf)^2 = ",-(cr.y+eps));
printf("%.3lf^2\n",r+eps);
c = cr.x*;
d = cr.y*;
e = cr.x*cr.x + cr.y*cr.y - r*r;
printf("x^2 + y^2 ");
if(c > -eps)
printf("+ %.3fx ",c+eps);
else
printf("- %.3fx ",-(c+eps));
if(d > -eps)
printf("+ %.3fy ",d+eps);
else
printf("- %.3fy ",-(d+eps));
if(e > -eps)
printf("+ %.3f = 0\n\n",e+eps);
else
printf("- %.3f = 0\n\n",-(e+eps));
}
}

POJ 1329 Circle Through Three Points(三角形外心)的更多相关文章

  1. POJ 1329 Circle Through Three Points(三角形外接圆)

    题目链接:http://poj.org/problem?id=1329 #include<cstdio> #include<cmath> #include<algorit ...

  2. POJ - 1329 Circle Through Three Points 求圆

    Circle Through Three Points Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4112   Acce ...

  3. ●POJ 1329 Circle Through Three Points

    题链: http://poj.org/problem?id=1329 题解: 计算几何,求过不共线的三点的圆 就是用向量暴力算出来的东西... (设出外心M的坐标,由于$|\vec{MA}|=|\ve ...

  4. poj 1329 Circle Through Three Points(求圆心+输出)

    题目链接:http://poj.org/problem?id=1329 输出很蛋疼,要考虑系数为0,输出也不同 #include<cstdio> #include<cstring&g ...

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

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

  6. poj1329 Circle Through Three Points

    地址:http://poj.org/problem?id=1329 题目: Circle Through Three Points Time Limit: 1000MS   Memory Limit: ...

  7. POJ 1329 三角外接圆

    Circle Through Three Points Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3169   Acce ...

  8. poj 1329(已知三点求外接圆方程.)

    Circle Through Three Points Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3766   Acce ...

  9. poj 1981 Circle and Points

    Circle and Points Time Limit: 5000MS   Memory Limit: 30000K Total Submissions: 8131   Accepted: 2899 ...

随机推荐

  1. ***电商数据库设计参考:ecshop数据库+订单表结构等

    ecshop订单表结构ecs_order_info说明 -- 表的结构 `ecs_order_info`    CREATE TABLE IF NOT EXISTS `ecs_order_info` ...

  2. ASP.NET MVC 伪静态的实现

    public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.Ignore ...

  3. 算法系列:XXX

    转载自http://www.cnblogs.com/skynet/p/3372855.html 这次分享的宗旨是——让大家学会创建与使用静态库.动态库,知道静态库与动态库的区别,知道使用的时候如何选择 ...

  4. Unity3D项目开发一点经验

    我们主要使用3dsmax2010进行制作,输出FBX的类型导入Unity3D中.默认情况下,3dsmax8可以和U3D软件直接融合,自动转换为FBX物体. 注意事项如下: 1.面数控制 在MAX软件中 ...

  5. GitHub 使用教程图文详解(转)

    大纲: 一.前言 二.GitHub简介 三.注册GitHub账号 四.配置GitHub 五.使用GitHub 六.参与GitHub中其它开源项目 七.总结 注,GitHub官网:https://git ...

  6. HDU 5145 NPY and girls 莫队+逆元

    NPY and girls Problem Description NPY's girlfriend blew him out!His honey doesn't love him any more! ...

  7. 【项目经验】EasyUI Tree

    ITOO5.0开始了,我参加了伟大的基础系统,从整体上来说,基础系统有三个职能: 1.自己的核心职能--选课(公共选修课,专业选修课),课表: 2.为其他系统提供真实数据: 3.维护信息 而近两三天, ...

  8. git学习 git-flow

    例子 初始化 在git init之后执行git init flow;接下来的命名约定建议使用默认值; 新特性 为即将发布的版本开发新功能特性. 这通常只存在开发者的库中. 增加新特性 git flow ...

  9. css整理-04 基本视觉格式化

    基本框 假定每一个元素都会生成一个火多个矩形框,为元素框 元素框中心有一个内容区,周围有内边距,边距和外边距 内容的背景会应用到内边距,外边距是透明的,可以看到父元素的背景 内边距不能是负值,外边距可 ...

  10. coffeeScript学习02

    闭包 closure = do -> _private = "foo" -> _private console.log(closure()) #=> " ...