• 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
    %lf
    %lf
    ",c,a,b);
    22 
    23        }
    24      return 0 ;
    25     }
    View Code
    没有梦想,何谈远方
  • 相关阅读:
    docker 第六篇 dockerfile
    docker 第五篇 存储
    8.4总结
    消失之物,分治
    NOIP模拟9
    卡特兰数总结
    【洛谷】P3537 [POI2012]SZA-Cloakroom
    0915 N校联考
    [树链剖分]BZOJ3589动态树
    0905膜你赛测试
  • 原文地址:https://www.cnblogs.com/zyue/p/3304199.html
Copyright © 2020-2023  润新知