Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
。。。。#include <iostream> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <algorithm> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; double dis(double x,double y,double x1,double y1) { return (x-x1)*(x-x1)+(y-y1)*(y-y1); } int main() { double x1,x2,y1,y2; scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2); double x,y; bool ok=false; while(scanf("%lf%lf",&x,&y)!=EOF) { if(ok||4*dis(x,y,x1,y1)>=dis(x,y,x2,y2))continue; ok=true; printf("The gopher can escape through the hole at (%.3f,%.3f).\n",x,y); } if(!ok) puts("The gopher cannot escape."); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator