1 #include<iostream> 2 #include<iomanip> 3 using namespace std; 4 5 int main() 6 { 7 //freopen("acm.acm","r",stdin); 8 double x1; 9 double y1; 10 double x2; 11 double y2; 12 double hol_x; 13 double hol_y; 14 double len_gop; 15 double len_dog; 16 bool boo = false; 17 cin>>x1>>y1>>x2>>y2; 18 while(cin>>hol_x>>hol_y) 19 { 20 len_gop = (x1-hol_x)*(x1-hol_x) + (y1-hol_y)*(y1-hol_y); 21 len_dog = (x2-hol_x)*(x2-hol_x) + (y2-hol_y)*(y2-hol_y); 22 if(len_dog/4.000 > len_gop) 23 { 24 cout<<"The gopher can escape through the hole at ("<<setiosflags(ios::fixed)<<setprecision(3)<<hol_x<<","<<hol_y<<")."<<endl; 25 boo = true; 26 break; 27 } 28 } 29 if(!boo) 30 cout<<"The gopher cannot escape."<<endl; 31 }
时间: 2024-10-10 08:22:35