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 loop1(i,n) for(int i=1; i<=int(n); i++)
- #define loop(i,y) for(int i=0; i<int(y); i++)
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- #define cspf(i) printf("Case %d: ", i)
- /// Constants
- #define eps 1e-9
- #define PI acos(-1.0) // 3.1415926535897932
- int main()
- {
- int n,i;
- scanf("%d",&n);
- loop1(i,n){
- double w,l,r,s,angle,hi,lo,mid,length;
- scanf("%lf : %lf",&l,&w);
- cspf(i);
- r=(sqrt(w*w+l*l))/2.0;
- angle=acos((2*r*r-w*w)/2*r*r);
- int k=60;
- hi=400;
- lo=0;
- while(k--){
- mid=(lo+hi)/2;
- r=mid;
- s=r*angle;
- l=400-(2*angle);
- w=sqrt(2*r*r-2*r*r*cos(angle));
- length=2*s+2*l;
- if(length<400)
- hi=mid;
- else
- lo=mid;
- }
- printf("%lf %lf\n",l,w);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement