#include <iostream.h> #define pi 3.141592653589793 #include <math.h> #include <fstream.h> ifstream f("circle.in"); #define cin f #include<iomanip.h> int main() { //float a,b,c,d,e,f; float x1,x2,x3,y1,y2,y3,x,y,r; while(cin>>x1>>y1>>x2>>y2>>x3>>y3) { float k1,k2; /*x1=(long)(a*10); y1=(long)(b*10); x2=(long)(c*10); y2=(long)(d*10); x3=(long)(e*10); y3=(long)(f*10); */ if((int)(10*y1)!=(int)(10*y2) && (int)(10*y3)==(int)(10*y2)) { k2=-(x1-x2)/(y1-y2); x=(x3+x2)/2; y=k2*(x-(x2+x1)/2)+(y2+y1)/2; } else if((int)(10*y1)==(int)(10*y2) && (int)(10*y3)!=(int)(10*y2)) { k1=-(x3-x2)/(y3-y2); x=(x1+x2)/2; y=k1*(x-(x2+x3)/2)+(y2+y3)/2; } else { k1=-(x1-x2)/(y1-y2); k2=-(x3-x2)/(y3-y2); x=(y3-y1+k1*(x1+x2)-k2*(x2+x3))/(k1-k2)/2; y=k1*x+(y1+y2-k1*x1-k1*x2)/2; } //cout<<x<<" "<<y<<endl; //else if((int)(10*y1)==(int)(10*y2)) //k1=1; //else //k1=-(x1-x2)/(y1-y2); //if((int)(x3*10)==(int)(x2*10)) //k2=0; //else if((int)(10*y3)==(int)(10*y2)) //k2=1; //else //k2=-(x3-x2)/(y3-y2); //x=(y3-y1+k1*(x1+x2)-k2*(x2+x3))/(k1-k2)/2; //y=k1*x-(y1+y2-k1*x1-k1*x2)/2; r=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)); //cout<<2*pi*r<<endl; cout.setf(ios::fixed); cout<<setprecision(2)<<2*pi*r<<endl; } }

评论