#include <iostream>
#include <iomanip>
//希望自己好好学英语 感谢博友程序
using namespace std;
int main()
{
double a1,a2,b1,b2;//float不能通过
cin>>a1>>a2>>b1>>b2;
double min=-1;
double jg1,jg2;
while(1)
{
double c1,c2;
cin>>c1>>c2;
if(cin.eof()==1)
{
break;
}
double t1,t2;
t1=((a1-c1)*(a1-c1)+(a2-c2)*(a2-c2));
t2=((b1-c1)*(b1-c1)+(b2-c2)*(b2-c2))/4;
if(t1<t2)
{
if(min==-1)
{
min=t1;
jg1=c1;
jg2=c2;
}else if(min>t1)
{
min=t1;
jg1=c1;
jg2=c2;
}
}
}
cout <<setprecision(3) <<std::fixed;
if(min==-1)
{
cout<<"The gopher cannot escape.";
}else
{
cout<<"The gopher can escape through the hole at ("<<jg1<<","<<jg2<<").";
}
return 0;
}
POJ 2610 Dog & Gopher G++
最新推荐文章于 2020-10-03 18:37:01 发布