Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
超级大发现,能看懂吧#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<string> using namespace std; #define pi 3.141592653589793 double X1,Y1,X2,Y2,X3,Y3,X4,Y4; inline double sqr(double X){ return X*X; } inline double dis(double a,double b,double c,double d){ return sqrt(sqr(a-c) + sqr(b - d)); } int main(){ while (scanf("%lf%lf%lf%lf%lf%lf",&X1,&Y1,&X2,&Y2,&X3,&Y3) != EOF){ double a = dis(X1,Y1,X2,Y2),b = dis(X1,Y1,X3,Y3),c = dis(X2,Y2,X3,Y3); double p = (sqr(a) + sqr(b) + sqr(c)) / 2.0; double q = p - sqr(a); q = 1/q; double s = p - sqr(b); s = 1/s; q+=s; s = p - sqr(c); s = 1/s; q += s; q = 1/q; double r = (p - q)/4.0; r = sqrt(r); printf("%.2lf\n",2*pi*r); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator