10310

#include <iostream>
#include <stdio.h>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
    int n;
    double Dg,Dd;
    double x1,y1,x2,y2;
    double a,b,Hx,Hy;
    bool caught = true;
    while(cin>>n)
    {
        cin>>x1>>y1>>x2>>y2;
        caught = true;
        for(int i=0;i<n;i++)
        {
            cin>>a>>b;

            if(!caught)
            continue;
            Dg = sqrt((a-x1)*(a-x1)+(b-y1)*(b-y1));
            Dd = sqrt((a-x2)*(a-x2)+(b-y2)*(b-y2));

            double t = (Dg*2)/Dd;
            if(t>1)
            {
               caught=1;
            }
            else
            {
               Hx= a;
               Hy= b;
               caught=0;
            }
        }

        if(!caught)
        printf("The gopher can escape through the hole at (%.3lf,%.3lf).\n",Hx,Hy);
        //cout<<"The gopher can escape through the hole at ("<<Hx<<","<<Hy<<").\n";
        else
        cout<<"The gopher cannot escape.\n";
    }

    return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *