Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define frac() cout.unsetf(ios::floatfield);cout.precision(10);cout.setf(ios::fixed,ios::floatfield);
- int main(){
- ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- int t;
- cin>>t;
- for(int j=1;j<=t;j++){
- double ab,bc,ac,rr;
- cin>>ab>>ac>>bc>>rr;
- double l=0,r=ab;
- double ad;
- for(int i=1;i<=100;i++){
- ad=(l+r)/2.0; //8.134 9.098 7.123 5.10
- double x=ad/ab;
- double ae=ac*x;
- double de=bc*x;
- double pabc=(ab+bc+ac)/2.0;
- double pade=(ad+ae+de)/2.0;
- double Aabc=sqrt(pabc*(pabc-ab)*(pabc-bc)*(pabc-ac));
- double Aade=sqrt(pade*(pade-ad)*(pade-de)*(pade-ae));
- double Atrap=Aabc-Aade;
- if(rr<(Aade/Atrap)) r=ad;
- else l=ad;
- }
- frac();
- cout<<"Case"<<" "<<j<<":"<<" "<<ad<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement