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 acm_bug at 2006-10-04 09:57:07 on Problem 2610
In Reply To:不知道怎么结束输入 Posted by:acm_bug at 2006-10-04 09:49:22
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    double x0,y0,x1,y1,x,y,d0,d1,xx,yy;
    bool eat=1;int i=0;
    cin>>x0>>y0>>x1>>y1;
    while(scanf("%f%f",&x,&y)!=EOF&&i<1000)
    {++i;
                 d0=(x0-x)*(x0-x)+(y0-y)*(y0-y);
                 d1=(x-x1)*(x-x1)+(y-y1)*(y-y1);
                 if(d1>4*d0&&eat==1){eat=0;xx=x;yy=y;}
    }
    if(!eat)cout<<"The gopher can escape through the hole at ("<<xx<<","<<yy<<")."<<endl;
    else cout<<"The gopher cannot escape."<<endl;
    getchar();
    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