-
//http://acm.zju.edu.cn/show_problem.php?pid=1090
-
//zoj1090 The Circumference of the Circle
-
//Accepted 1090 C++ 00:00.00 396K
-
#include <stdio.h>
-
#include <math.h>
-
#define PI acos(-1.0)
-
int main()
-
{
-
#ifndef ONLINE_JUGDE
-
freopen("1090.txt","r",stdin);
-
#endif
-
double x1,y1,x2,y2,x3,y3,r,a,b,c,p,S,ans;
-
while (scanf ("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3) != EOF){
-
a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
-
b = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
-
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 = 0.25*a*b*c/S;
-
ans = 2*PI*r;
-
printf ("%.2lf/n",ans);
-
}
-
#ifndef ONLINE_JUGDE
-
fclose(stdin);
-
#endif
-
return 0;
-
}
zoj1090 The Circumference of the Circle
最新推荐文章于 2018-08-29 16:45:28 发布
本文提供了一道ZJU 1090题目(圆的周长计算)的C++实现代码。该程序通过输入三角形的三个顶点坐标,计算出三角形的三边长度,进而求得外接圆半径并计算出圆的周长。
270

被折叠的 条评论
为什么被折叠?



