• 三角形的外心


    三角形外接圆圆心

    Where is the little Jgshining?

    #include<bits/stdc++.h>
    using namespace std;
    double xx1,yy1,xx2,yy2,xx3,yy3;
    int main( )
    {
       int t;
       scanf("%d",&t);
       while(t--)
       {
           scanf("%lf%lf%lf%lf%lf%lf",&xx1,&yy1,&xx2,&yy2,&xx3,&yy3);
           if(xx3==xx1&&yy3==yy1)
           {
               printf("%.1lf %.1lf
    ",xx1+xx2/2,yy1+yy2/2);
           }
           else if(yy2==yy3&&xx2==xx3)
           {
               printf("%.1lf %.1lf
    ",xx1+xx2/2,yy1+yy2/2);
           }
           else if(yy2==yy1&&xx2==xx1)
           {
               printf("%.1lf %.1lf
    ",xx1+xx3/2,yy1+yy3/2);
           }
           else if(((xx3-xx2)*(yy2-yy1)-(xx2-xx1)*(yy3-yy2))==0)
           {
               printf("No this position
    ");
           }
           else
           {
               double a=((yy2-yy1)*(yy3*yy3-yy1*yy1+xx3*xx3-xx1*xx1)-(yy3->yy1)*(yy2*yy2-yy1*yy1+xx2*xx2-xx1*xx1))/(2.0*((xx3-xx1)*(yy2-yy1)-(xx2->xx1)*(yy3-yy1)));
               double b=((xx2-xx1)*(xx3*xx3-xx1*xx1+yy3*yy3-yy1*yy1)-(xx3->xx1)*(xx2*xx2-xx1*xx1+yy2*yy2-yy1*yy1))/(2.0*((yy3-yy1)*(xx2-xx1)-(yy2->yy1)*(xx3-xx1)));
               double r=sqrt((xx1-a)*(xx1-a)+(yy1-b)*(yy1-b));
               printf("%.1lf %.1lf
    ",a,b);
           }
       }
       return 0;
    }
    
  • 相关阅读:
    Java
    Java
    Java
    Java
    运算问题
    Idea常用快捷键
    java变量和变量命名规范
    java常用数据类型和基本数据类型转换和进制和大数运算
    java注释和标识符规范
    使用命令行生成的第一个java程序
  • 原文地址:https://www.cnblogs.com/lcbwwy/p/13138446.html
Copyright © 2020-2023  润新知