天天看点

ZOJ 2559 The Smart Bomb

题意:给定你三个圆心,三个圆相交,求每个圆心大小

ZOJ 2559 The Smart Bomb
ZOJ 2559 The Smart Bomb

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     }      

View Code