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();}

浙公网安备 33010602011771号