Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

另外一种方法

Posted by ccl66 at 2017-08-13 10:25:20 on Problem 2242
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator