Problem: Example

Input

100 1 0
50 100


Output

14.57738

Solution (in CPP):

Solution:
// Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

double calculate(double vx, double vy, double x){
    return -(x*x)/(2*vx*vx)+(vy*x)/vx;
}

double calc(double x , double x0 , double y){
    return sqrt((x*(-x+x0))/(2*y));
}

int main(){
    double d;
    int n , b;
    vector < pair <double , double> > obs;
    
    cin >> d >> n >> b;
    
    for(int i = 0 ; i < n ; i ++){
        double a,b;
        
        cin >> a >> b;
        
        obs.pb(mp(a,b));
    }
    
    
    double ans = 10e15;
    
    //cout << endl << endl;
    for(int i = 0 ; i <= b ; i++){
        double x0 = d / double(i+1);
        
        //cout << "x0 " << x0 << endl;
        
        double miXX = 10e10;
        
        int flag = 1;
        
        for(int j = 0 ; j < n ; j++){
            double kk = obs[j].xx;
            while(kk >= x0) kk-=x0;
            double miX = calc( kk , x0 , obs[j].yy);
            double miY = x0 / (2*miX);
            
            if(kk <= 0 ) flag = 0;
            
            //cout << "W " << miX << " " << miY << " " << sqrt(miX*miX + miY*miY) << endl;
            //cout << "H " << kk << " " << calculate(miX,miY,kk) << endl;
            
            double maa = 2*miX*miY;
            
            if(maa > kk){
                if(miX < miXX) miXX = miX;
            }
        }
        
        //cout << miXX << endl;
        
        double miYY = x0 / (2*miXX);
        
        //cout << "tan" << miYY / miXX;
        
        double tanX = miYY / miXX;
        
        if(tanX < 1.00){
            miXX = sqrt(x0/2.00);
            miYY = miXX;
        }
        
        //cout << "t " << tanX << endl;
        //cout << flag << endl;
        if(flag == 1){
            //cout << sqrt(miXX*miXX + miYY * miYY) << endl;
            ans = min(ans , sqrt(miXX*miXX + miYY * miYY));
        }
        //cout << "aa " << miXX << " " << miYY << " " << sqrt(miXX*miXX + miYY * miYY) << endl << endl;
        
        //cout << endl << endl;
    }
    
    cout << setprecision(10) << ans << endl;
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}