Problem 1896 --Problem D: Dog & Gopher

1896: Problem D: Dog & Gopher

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $4$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

Problem D: Dog & Gopher

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.

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.

1.000 1.000 2.000 2.000
1.500 1.500
The gopher cannot escape.

Sample Input 2

2.000 2.000 1.000 1.000
1.500 1.500
2.500 2.500

Output for Sample Input 2

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

推荐代码 查看1896 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 淡意的温柔 588989 2020-05-30 10:38:01
内存最少[$960 $KB] AOJ大管家 84411 2017-04-27 15:28:38
第一AC AOJ大管家 84411 2017-04-27 15:28:38
第一挑战 AOJ大管家 84411 2017-04-27 15:28:38

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛