22327_Dog&Gopher

2022-5-16 18:21| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506326013300-Problem List-采集的数据-后羿采集器.html

Pro.ID

22327

Title

Dog & Gopher

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22327

AC

1

Submit

3

Ratio

33.33%

时间&空间限制

  • Time Limit: 1200/400 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    A large field has a dog and a gopher. The dog wants to eat the gopher, while the gopher wants to run to safety through one of several gopher holes dug in the surface of the field.

    Neither the dog nor the gopher is a math major; however, neither is entirely stupid. The gopher decides on a particular gopher hole and heads for that hole in a straight line at a fixed speed. The dog, which is very good at reading body language, anticipates which hole the gopher has chosen, and heads at double the speed of the gopher to the hole, where it intends to gobble up the gopher. If the dog reaches the hole first, the gopher gets gobbled; otherwise, the gopher escapes.

    You have been retained by the gopher to select a hole through which it can escape, if such a hole exists.

    输入

    The first line of input contains four floating point numbers: the (x,y) coordinates of the gopher followed by the (x,y) coordinates of the dog. Subsequent lines of input each contain two floating point numbers: the (x,y) coordinates of a gopher hole. All distances are in metres, to the nearest mm.

    输出

    Description
    A large field has a dog and a gopher. The dog wants to eat the gopher, while the gopher wants to run to safety through one of several gopher holes dug in the surface of the field.

    Neither the dog nor the gopher is a math major; however, neither is entirely stupid. The gopher decides on a particular gopher hole and heads for that hole in a straight line at a fixed speed. The dog, which is very good at reading body language, anticipates which hole the gopher has chosen, and heads at double the speed of the gopher to the hole, where it intends to gobble up the gopher. If the dog reaches the hole first, the gopher gets gobbled; otherwise, the gopher escapes.

    You have been retained by the gopher to select a hole through which it can escape, if such a hole exists.

    Input
    The first line of input contains four floating point numbers: the (x,y) coordinates of the gopher followed by the (x,y) coordinates of the dog. Subsequent lines of input each contain two floating point numbers: the (x,y) coordinates of a gopher hole. All distances are in metres, to the nearest mm.
    Output
    Your output should consist of a single line. If the gopher can escape the line should read "The gopher can escape through the hole at (x,y)." identifying the appropriate hole to the nearest mm. Otherwise the output line should read "The gopher cannot escape." If the gopher may escape through more than one hole, any one will do. If the gopher and dog reach the hole at the same time either answer may be given. There are not more than 1000 gopher holes and all coordinates are between -10000 and +10000.
    Sample Input

    Sample 1

    1.000 1.000 2.000 2.000
    1.500 1.500

    Sample 2

    2.000 2.000 1.000 1.000
    1.500 1.500
    2.500 2.500
    Sample Output

    Sample 1

    The gopher cannot escape.

    Sample 2

    The gopher can escape through the hole at (2.500,2.500).
    Source

    样例输入

    Sample 1

    1.000 1.000 2.000 2.000
    1.500 1.500

    Sample 2

    2.000 2.000 1.000 1.000
    1.500 1.500
    2.500 2.500

    样例输出

    Sample 1

    The gopher cannot escape.

    Sample 2

    The gopher can escape through the hole at (2.500,2.500).

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部