Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define fraction() cout.unsetf(ios::floatfield);cout.precision(10);cout.setf(ios::fixed,ios::floatfield);
- using namespace std;
- const double spc=1e-6;
- int main()
- {
- int t;
- cin>>t;
- for(int tc=1;tc<=t;tc++)
- {
- double ab,ac,bc,ra,ae,de,abc,ade,p1,p2,bdec;
- cin>>ab>>ac>>bc>>ra;
- p1=(ab+ac+bc)/2;
- abc=sqrt(p1*(p1-ab)*(p1-ac)*(p1-bc));
- double l=0,r=ab;
- for(int i=0;i<100;i++)
- {
- double mid=(l+r)/2;
- ae=(mid/ab)*ac;
- de=(mid/ab)*bc;
- p2=(mid+ae+de)/2;
- ade=sqrt(p2*(p2-ae)*(p2-de)*(p2-mid));
- bdec=abc-ade;
- if((ade/bdec)>ra) r=mid;
- else l=mid;
- }
- fraction();
- cout<<"Case "<<tc<<": "<<l<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement