(模拟+floyd)Saving James Bond
題目:
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, outp**ut 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
題意:鱷魚的坐標,n是鱷魚的數(shù)目,d是一步跳的最遠距離
題目輸出他走到終點需要的最小距離,還有最小的距離中走的最小的步數(shù)
參考代碼:
https://blog.csdn.net/libin56842/article/details/17034011
實現(xiàn)起來有點崩潰
總結(jié)
以上是生活随笔為你收集整理的(模拟+floyd)Saving James Bond的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 友元是c还是java_[C++]【类】友
- 下一篇: 仓库货位卡标识牌_【干货】仓库布局,你想