题目链接

抄的外心模版。然后,输出认真一点。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. Android N 新特性 + APP开发注意事项

    1. 多窗口MultiWindow 多窗口MultiWindow,这是Android N里对开发者影响比较大的特性,也是大家疑问比较多的地方.站在开发者的角度其实不必太担心这个特性会导致我们需要修改很 ...

  2. 自制工具:迅速打开一个Node 环境的Playground

    需求 经常有这种情况,写代码的时候需要实验种想法,亟需一种playground 环境来玩耍.如果是前端的话可以打开chrome 的控制台,但是如果是Node 的话就比较麻烦了.我要打开我的存放试验代码 ...

  3. Solr入门之(6)配置文件solrconfig.xml

    solrconfig.xml包含了用于配置自身行为的绝大部分参数,其作用范围是当前core.该文件位于${solr_home}/solr/core1/conf/下. 参数列表概览: A.lib B.d ...

  4. h264 profile & level

    转自:http://blog.csdn.net/sphone89/article/details/17492433 H.264 Profiles H.264有四种profile,每个profile支持 ...

  5. unity3D与网页的交互---做项目的一点总结

    (来自博客园) 由于项目需要,要求用unity来展示三维场景,并在三维中能够方便的查询数据库等.一开始尝试在unity中直接连接数据库,当时连的xml,然而每次发布成网页后都会出现路径找不到等问题,所 ...

  6. 十天来学习java的心得体会

    有关学习java是几天来的心得体会: 十天学习java遇到很多问题,每个问题都是经过反复的看书本以及上网查找资料来解决的,发现这一点真的需要自己来而不是去遇到什么问题就去依靠他人(师兄.同学).在其中 ...

  7. whl文件安装

    进入whl文件的目录,直接pip install ...即可

  8. strcmp函数使用总结

    Action() { /********************************* * Author:旺仔 * object:strcmp * date:2015-12-09 * fuc:我输 ...

  9. DataTables - 问题集

    1.增加额外搜索条件 var reqData = {}; var extraSearch = []; var oTable = $('table selector').dataTable({ 'aja ...

  10. 动态添加PopupWindow

    动态添加PopupWindow的方法private void showPopupWindow() { LayoutInflater inflater = LayoutInflater.from(thi ...