Problem: Example

Input

100 1 0
50 100


Output

14.57738

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>
#include <ctime>
#include <list>
#include <complex>
#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const double EPS = 1e-9;

bool check(double x, double y, double vx, double vy){
	double yy = -1 / 2. / vx / vx*x*x + vy / vx*x;
	return y < yy + EPS;
}

int main(){
	int d, n, b;
	cin >> d >> n >> b;

	vector<int> p(n), h(n);
	rep(i, n) cin >> p[i] >> h[i];

	double ans = 1e100;
	FOR(i, 1, b + 2){
		double len = (double)d / i;

		double lb = 0, ub = sqrt(len / 2);
		rep(j, 10000){
			double mid = (lb + ub) / 2;
			bool ok = true;
			rep(k, n){
				double pp = p[k];
				while (pp > len - EPS) pp -= len;
				ok &= check(pp, h[k], mid, len / 2 / mid);
			}
			if (ok) lb = mid;
			else ub = mid;
		}
		if (lb < EPS) continue;
		double vx = lb, vy = len / 2 / vx;
		ans = min(ans, sqrt(vx*vx+vy*vy));
	}
	cout.setf(ios::fixed);
	cout.precision(10);
	cout << ans << endl;


	return 0;
}