#include<bits/stdc++.h>
#define er 1000000
using namespace std;
typedef long long ll;
double x,y,c;
double eqn(double z)
{
double a=1/(sqrt(x*x-z*z));
double b=1/(sqrt(y*y-z*z));
return (a+b);
}
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
double mid,l,r;
cin>>x>>y;
cin>>c;
l=0.0;
r=min(x,y);
while(r-l>0.0000001)
{
mid=(r+l)/2.0;
//cout<<mid<<endl;
double tmp=1/c;
if(eqn(mid)>tmp)
{
r=mid;
}
else
{
l=mid;
}
}
printf("Case %lld: %.10f\n",k,mid);
}
return 0;
}
#define er 1000000
using namespace std;
typedef long long ll;
double x,y,c;
double eqn(double z)
{
double a=1/(sqrt(x*x-z*z));
double b=1/(sqrt(y*y-z*z));
return (a+b);
}
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
double mid,l,r;
cin>>x>>y;
cin>>c;
l=0.0;
r=min(x,y);
while(r-l>0.0000001)
{
mid=(r+l)/2.0;
//cout<<mid<<endl;
double tmp=1/c;
if(eqn(mid)>tmp)
{
r=mid;
}
else
{
l=mid;
}
}
printf("Case %lld: %.10f\n",k,mid);
}
return 0;
}
No comments:
Post a Comment