Problem: Example

Input

100 1 0
50 100


Output

14.57738

Solution (in CPP):

Solution:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define INF 1e9
using namespace std;

double d;
int n,b;
double p[11],h[11];

double C(int bt){
	double ang=0.0;
	bt++;
	double bx=(double)d/bt;
	for(int i=0;i<n;i++){
		double lx=fmod(p[i],(double)d/bt);
		double vx=sqrt((1.0/(2.0*h[i]))*(-lx*lx+lx*bx));
		double vy=bx/(2.0*vx);
		ang=max(ang,atan2(vy,vx));
	}
	ang=max(M_PI/4,ang);
	double v=sqrt(d/(2.0*sin(ang)*cos(ang)*bt));
	return v;
}

int main(void){
	scanf("%lf %d %d",&d,&n,&b);
	for(int i=0;i<n;i++){
		scanf("%lf %lf",&p[i],&h[i]);
	}
	double res=INF;
	for(int i=0;i<=b;i++){
		res=min(res,C(i));
	}
	printf("%.10f\n",res);
	return 0;
}