Problem: Example

Input

100 100 0 1


Output

1.16699564

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793238
signed main(){
  double x,y,t,w;
  cin>>x>>y>>t>>w;
  double R=sqrt(x*x+y*y); 
  t*=(2*PI)/360;
  double t1=atan2(y,x),t2=t;
  if(t1<0) t1+=2*PI;
  if(t1>t2) swap(t1,t2);
  double dt=min(t2-t1,t1+2*PI-t2);
  double lb=0,ub=w/360*2*PI*R;
  for(int k=0;k<2000;k++){
    double v=(lb+ub)/2;
    double r=v/(2*PI)*(360/w);
    double e=sqrt(R*R-r*r);
    double th=atan2(e,r);
    if(th<0) th+=2*PI;
    double len=(dt+th)*r;
    if(e<=len) ub=v;
    else lb=v;
  }
  printf("%.12f\n",ub);
  return 0;
}