zoj1392
来源:互联网 发布:女生好听的英文名知乎 编辑:程序博客网 时间:2024/06/11 03:31
# include <stdio.h># include <math.h>struct node{ double x,y;};node inser(node a,node b,node c,node d){ node f=a; double t=((a.x-c.x)*(c.y-d.y)-(a.y-c.y)*(c.x-d.x))/((a.x-b.x)*(c.y-d.y)-(a.y-b.y)*(c.x-d.x)); f.x+=(b.x-a.x)*t; f.y+=(b.y-a.y)*t; return f;}int main (){ node a,b,c,d,e; while(scanf("%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y)!=EOF) { d.x=(a.x+b.x)/2.0; d.y=(a.y+b.y)/2.0; e.x=(b.x+c.x)/2.0; e.y=(b.y+c.y)/2.0; node d1,e1; d1.x=d.x-(a.y-b.y); d1.y=d.y+(a.x-b.x); e1.x=e.x-(b.y-c.y); e1.y=e.y+(b.x-c.x); node t=inser(e1,e,d,d1); double r=sqrt((t.x-a.x)*(t.x-a.x)+(t.y-a.y)*(t.y-a.y)); double e=t.x*t.x+t.y*t.y-r*r; char k1='-',k2='-',k3='-'; if(t.x<0.0) k1='+'; if(t.y<0.0) k2='+'; if(e>0.0) k3='+'; printf("(x %c %.3lf)^2 + (y %c %.3lf)^2 = %.3lf^2\n",k1,fabs(t.x),k2,fabs(t.y),r); printf("x^2 + y^2 %c %.3lfx %c %.3lfy %c %.3lf = 0\n",k1,2*fabs(t.x),k2,2*fabs(t.y),k3,fabs(e)); printf("\n"); } return 0;}水题吧 求外接圆的半径还有圆心。。但是两条直线求交点的那个公式背不下来啊。。。。。。。
0 0
- zoj1392
- [水]ZOJ1392
- 关于c语言结构体偏移的一点思考
- struts2问题
- PHP 类的继承 extends 关键字
- 使用Hibernate Annotations
- hdu4577 X-Boxes ACM-ICPC杭州赛区全国邀请赛 2
- zoj1392
- 关于c语言内存地址对齐的一点思考
- C++虚析构函数
- PHP命名空间(Namespace)的使用详解
- 有关图像分割算法的几个网站
- NOJ [1358] An Easy Problem
- hdu 2807 The Shortest Path(矩阵相乘+floyd)
- 关于c语言等于运算符的一点思考
- vs2012编译xapian问题2 ------U1077,返回代码0x2