UVA10649 Danger Point 题解
sqh_let_it_be · · 题解
Update by 2023 年 10 月 2 日:
修改了部分错误,删除了代码中多余部分。
这个题因为UVA的传统艺能让我WA了好几次
翻译
我们过
若 INCORRECT INFORMATION !!! 。
Code:
#include<bits/stdc++.h>
using namespace std;
bool ok=true;
int main()
{
while(ok)
{
double x,y;
cin>>x>>y;
if(x==0&&y==0)
return 0;
double r=x/2,l=y;//半径为直径的一半
double ans,ans1;
ans1=2*r*r-l*l;
if(ans1<=0)
cout<<"INCORRECT INFORMATION !!!"<<endl;
else
{
ans=sqrt(ans1);
printf("%.6lf",ans);
cout<<endl;
}
}
return 0;
}