The Circumference of the Circle

时间:2016-05-30 06:22:23
【文件属性】:

文件名称:The Circumference of the Circle

文件大小:679B

文件格式:CPP

更新时间:2016-05-30 06:22:23

Circle

#include #include #include using namespace std; int main(){ const double pi = 3.141592653589793; double x1,y1,x2,y2,x3,y3,cosA; double a,b,c; while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF) { a = (double)sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)); b = (double)sqrt((y3-y1)*(y3-y1)+(x3-x1)*(x3-x1)); c = (double)sqrt((y2-y3)*(y2-y3)+(x2-x3)*(x2-x3)); cosA = (b*b+c*c-a*a)/(2*b*c); printf("%.2f\n",pi*a/sqrt(1-cosA*cosA)); } return 0; }


网友评论