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 all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

#define PI acos(-1)

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  double x, y, theta, omega;
  cin >> x >> y >> theta >> omega;
  theta *= PI/180;
  omega *= PI/180;

  double R = sqrt(x*x+y*y);
  double alpha = atan2(y, x), beta = theta;
  if(alpha < 0) alpha += 2*PI;
  if(alpha > beta) swap(alpha, beta);
  double gamma = min(beta-alpha, 2*PI-beta+alpha);
  double fail = 0, pass = R*omega;
  rep(i, 200) {
    double v = (fail+pass)/2;
    double r = v/omega;
    double l = sqrt(R*R-r*r);
    double phi = atan2(l, r);
    if(phi < 0) phi += 2*PI;
    double ds = r*(gamma+phi);
    if(l <= ds) pass = v;
    else fail = v;
  }
  cout << pass << endl;

  return 0;
}