Problem: Example

Input

100 1 0
50 100


Output

14.57738

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using namespace std;

signed main(){
    double d,n,b;
    cin>>d>>n>>b;
    vector<pair<double,double>> v(n);
    rep(i,n){
        double p,h;
        cin>>p>>h;
        v[i]=mp(p,h);
    }
    double ans=DBL_MAX;
    rep(k,b+1){
        double l=d/(k+1);
        double vx=l/2;
        int c=0;
        rep(i,n){
            while((c+1)*l<v[i].fi)c++;
            double x=v[i].fi-c*l;
            if((x*l-x*x)/(2*vx)<v[i].se){
                vx=(x*l-x*x)/(2*v[i].se);
            }
        }
        ans=min(ans,vx+l*l/(4*vx));
    }
    printf("%f\n",sqrt(ans));
    return 0;
}