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<iostream> #include<cmath> #include<cstdio> #define PI 3.141592653589793 using namespace std; struct Point { double x,y; }p[4]; double dis(Point a,Point b) { double ans=sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); return ans; } int main() { while(cin>>p[1].x>>p[1].y>>p[2].x>>p[2].y>>p[3].x>>p[3].y) { double a=dis(p[2],p[3]),b=dis(p[1],p[2]),c=dis(p[1],p[3]); double cosa=(b*b+c*c-a*a)/(2*b*c); double sina=sqrt(1-cosa*cosa); double d=a/sina; printf("%.2f\n",PI*d); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator