Title

UVA10649 Danger Point 题解

解题思路

图如下:

我们考虑转化角,把 CAE 沿着 AB 翻转,翻转后把 O 与 C' 相连,可得角 C'OD 为直角,然后直接算就可以了。

AC 代码

#include<stdio.h>
#include<iostream>
#include<cmath>
double AB,DE;
inline void work(){
    scanf("%lf%lf",&AB,&DE);
    while(AB!=0||DE!=0){
        double r=AB*0.5;
        if(2.0*r*r-DE*DE<=0){
            std::puts("INCORRECT INFORMATION !!!");
            scanf("%lf%lf",&AB,&DE);
            continue;
        }
        double CE=std::sqrt(2.0*r*r-DE*DE);
        if(CE<=0) std::puts("INCORRECT INFORMATION !!!");
        else printf("%.6lf\n",CE);
        scanf("%lf%lf",&AB,&DE);
    }
}signed main(){work();}
posted @ 2023-10-25 19:52  UncleSam_Died  阅读(31)  评论(0)    收藏  举报  来源