Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- typedef unsigned long long int ull;
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- typedef pair<int,int> pii;
- typedef vector< pii > vii;
- typedef set<int> st;
- #define pb push_back
- #define pob pop_back
- #define mp make_pair
- #define ff first
- #define ss second
- #define loop(i,n) for(int i=1; i<=int(n); i++)
- #define lps(i,y) for(int i=0; i<int(y); i++)
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- /// Constants
- #define eps 1e-9
- #define PI acos(-1.0) // 3.1415926535897932
- int main()
- {
- read();
- int n,i,j;
- cin>>n;
- double x,y,c,h1,h2,hi,lo,mid,tc;
- loop(i,n){
- cin>>x>>y>>c;
- lo=0.0;
- hi=max(x,y);
- j=50;
- while(j--){
- mid=(hi+lo)/2.0;
- h1=sqrt((x*x)-(mid*mid));
- h2=sqrt((y*y)-(mid*mid));
- tc=(h1*h2)/(h1+h2);
- if(tc<c)
- hi=mid;
- else
- lo=mid;
- }
- printf("Case %d: %.10lf\n",i,mid);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement