编程介的小学生 2020-09-28 09:17 采纳率: 20.5%
浏览 28
已结题

Saving James Bond 代码的实现思路

Problem Description
This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he performed the most daring action to escape -- he jumped onto the head of the nearest crocodile! Before the animal realized what was happening, James jumped again onto the next big head... Finally he reached the bank before the last crocodile could bite him (actually the stunt man was caught by the big mouth and barely escaped with his extra thick boot).
Assume that the lake is a 100×100 square one. Assume that the center of the lake is at (0,0) and the northeast corner at (50,50). The central island is a disk centered at (0,0) with the diameter of 15. A number of crocodiles are in the lake at various positions. Given the coordinates of each crocodile and the distance that James could jump, you must tell him whether he could escape.If he could,tell him the shortest length he has to jump and the min-steps he has to jump for shortest length.

Input
The input consists of several test cases. Each case starts with a line containing n <= 100, the number of crocodiles, and d > 0, the distance that James could jump. Then one line follows for each crocodile, containing the (x, y) location of the crocodile. Note that x and y are both integers, and no two crocodiles are staying at the same position.

Output
For each test case, if James can escape, output in one line the shortest length he has to jump and the min-steps he has to jump for shortest length. If it is impossible for James to escape that way, simply ouput "can't be saved".

Sample Input
4 10
17 0
27 0
37 0
45 0
1 10
20 30

Sample Output
42.50 5
can't be saved

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本