码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 2610

时间:2015-06-11 12:37:57      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:

 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 }

 

POJ 2610

标签:

原文地址:http://www.cnblogs.com/gavinsp/p/4568621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!