1 条题解

  • 0
    @ 2024-12-24 9:59:30

    C :

    #include<stdio.h>
    #include<math.h>
    
    #define pi 3.141592653589793
    
    double sqr(double x)
    {
    	return x*x;
    }
    
    int main()
    {
    	double x1,y1,x2,y2,x3,y3,a,b,c,r;
    	while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
    	{
    		a=sqr(x1-x2)+sqr(y1-y2);
    		b=sqr(x1-x3)+sqr(y1-y3);
    		c=sqr(x2-x3)+sqr(y2-y3);
    		r=sqrt(c/4/(1-sqr(a+b-c)/4/a/b));
    		printf("%.2lf\n",2*pi*r);
    	}
    	return 0;
    }
    

    C++ :

    #include<stdio.h>
    #include<math.h>
    
    #define pi 3.141592653589793
    
    double sqr(double x)
    {
    	return x*x;
    }
    
    int main()
    {
    	double x1,y1,x2,y2,x3,y3,a,b,c,r;
    	while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
    	{
    		a=sqr(x1-x2)+sqr(y1-y2);
    		b=sqr(x1-x3)+sqr(y1-y3);
    		c=sqr(x2-x3)+sqr(y2-y3);
    		r=sqrt(c/4/(1-sqr(a+b-c)/4/a/b));
    		printf("%.2lf\n",2*pi*r);
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1667
    时间
    1000ms
    内存
    32MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者