2009-05-06 22:09:36來源不明

ACM 438 The Circumference of the Circle

作法:公式解(數學)
想法:算出邊長之後,海龍公式算面積 在利用R=A*B*C/4*(面積)
提供者:阿標同學(我懶得從打 原諒我唄)

/**********************************************************/

#include<stdio.h>
#include<math.h>
double xa,xb,ya,yb,xc,yc,a,b,c,s,line;
int main()
{
  while(scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&xb,&yb,&xc,&yc)==6)
  {
    a=sqrt( (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb) );
    b=sqrt( (xa-xc)*(xa-xc)+(ya-yc)*(ya-yc) );
    c=sqrt( (xb-xc)*(xb-xc)+(yb-yc)*(yb-yc) );
    s=(a+b+c)/2;
    line=a*b*c/sqrt(s*(s-a)*(s-b)*(s-c))/4;
    printf("%.2lf\n",2*3.141592653589793*line);
  }
  return 0;
}