Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

。。。。

Posted by keys at 2012-08-18 19:37:58 on Problem 2610
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator