• 笛卡尔定理


    若四圆两两外切,则:

    若半径为r1、r2、r3的圆内切于半径为r4的圆中,则:

    即4个圆外切,则他们曲率和的平方,等于2倍的曲率平方之和。(存在内切则该曲率取负号)

    HDU 6158 The Designer

    #include <iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<stdlib.h>
    using namespace std;
    #define PI acos(-1.0)
    #define eps 1e-7
    int main()
    {
        int T,n;
        double r1,r2;
        double k1,k2,k3,k4,k5;
        double ans;
        scanf("%d",&T);
        while(T--)
        {
            ans=0.0;
            scanf("%lf %lf %d",&r1,&r2,&n);
            if(r1<r2) swap(r1,r2);
            k1=-1.0/r1,k2=1.0/r2,k3=1.0/(r1-r2);
            ans+=(r1-r2)*(r1-r2);
            k4=k1+k2+k3;
            for(int i=1;i<n;i++)
            {
                ans+=(1.0/k4)*(1.0/k4);
                if(1.0/k4<eps) break;
                if(i+1<n) ans+=(1.0/k4)*(1.0/k4),i++;
                k5=2*(k1+k2+k4)-k3;
                k3=k4;
                k4=k5;
            }
            printf("%.5lf\n",ans*PI);
        }
        return 0;
    }

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6158

  • 相关阅读:
    js18
    js17
    js16
    js15
    js14
    js13
    js12
    js11
    八月二十三的php
    八月二十二的php
  • 原文地址:https://www.cnblogs.com/jc12138/p/9522659.html
Copyright © 2020-2023  润新知