题意:给定你三个圆心,三个圆相交,求每个圆心大小
解题代码:由于任意两个圆的半径和为其圆心的连线的长度,可以列出三个二元一次方程,求解可得
解题代码:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <math.h> 5 double distance(double x1,double y1,double x2,double y2) 6 { 7 return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); 8 } 9 int main() 10 { 11 double x1,x2,x3,y1,y2,y3; 12 while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3) != EOF) 13 { 14 double d1 = distance(x1,y1,x2,y2); 15 double d2 = distance(x1,y1,x3,y3); 16 double d3 = distance(x2,y2,x3,y3); 17 double a,b,c; 18 a = (d1+d3-d2)*1.0/2; 19 b = (d2+d3-d1)*1.0/2; 20 c = (d1+d2-d3)*1.0/2; 21 printf("%lf\n%lf\n%lf\n",c,a,b); 22 23 } 24 return 0 ; 25 }
没有梦想,何谈远方