Problem: Example

Input

100 1 0
50 100


Output

14.57738

Solution (in CPP):

Solution:
#include<bits/stdc++.h>

using namespace std;


int main()
{
  int D, N, B, X[10], Y[10];

  cin >> D >> N >> B;
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i];
  }
  double ret = 1e9;
  for(int i = 1; i <= B + 1; i++) {
    double bound = 1.0 * D / i;
    ret = min(ret, [&]()
    {
      double angle = 0.0;
      for(int j = 0; j < N; j++) {
        double xx = fmod(X[j], bound);
        double vx = sqrt((xx * bound - xx * xx) / 2.0 / Y[j]);
        angle = max(angle, atan2(bound / 2.0 / vx, vx));
      }
      angle = max(angle, acos(-1) * .25);
      return (sqrt(D / 2.0 / sin(angle) / cos(angle) / i));
    }());
  }
  cout << fixed << setprecision(10) << ret << endl;
}