Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define pi 3.14159265359
- using namespace std;
- int main()
- {
- double w,x1,y1,x,t;
- int tt;
- scanf("%d",&tt);
- for(int kk1=1;kk1<=tt;kk1++)
- {
- scanf("%lf%lf%lf%lf%lf",&x1,&y1,&x,&w,&t);
- double thet;
- bool fg =false;
- thet = t*w;
- if(thet<0.0)
- {
- fg = true;
- thet = thet*(-1.0);
- }
- double d,r;
- r = sqrt((x1*x1)+(y1*y1));
- d = sqrt(((x1-x)*(x1-x))+((y1-0)*(y1-0)));
- double th1,th2;
- th1 = (180.00*thet)/pi;
- th2 = acos((-d*d+x*x+r*r)/(2.00*x*r));
- double rad;
- th2 = (180.00*th2)/pi;
- if(fg)
- th1 = th2-th1;
- else
- th1 = th2+th1;
- rad = (pi*th1)/180.00;
- // cout<<th1<<endl;
- // cout<<cos(rad)<<endl;
- double a,b,c;
- b=2.00*r*cos(rad);
- a=1.00;
- c=(-1.0)*(d*d-r*r);
- b=b*(-1);
- // cout<<a<<" "<<b<<" "<<c<<endl;
- double ans1,ans2;
- ans1 = (-b+sqrt(b*b-4.00*a*c))/2.00*a;
- ans2 = (-b-sqrt(b*b-4.00*a*c))/2.00*a;
- // cout<<ans1<<" "<<ans2<<endl;
- ans1 =max(ans1,ans2);
- printf("Case %d: ",kk1);
- printf("%.10lf\n",ans1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement