关于捕获的坐标的计算方式,采用C语言怎么才能实现的,思路的步骤

Problem Description
The discovery of a remarkable new insect, the Lampyridae Teleportae, more commonly known as the teleporting firefly, has sparked a no-less-remarkable number of ways to try to catch them. Rather than flying, the Lampyridae Teleportae teleports from spot to spot by warping space-time. When it stops between teleports, it hovers for a moment and flashes its light in search of a mate. So, even though they only come out after dark, it's easy to observe them, but very difficult to catch them. Fortunately for the Association for Catching Lampyridae (ACL), student members of the Association for Cool Machinery (ACM) recently developed the world's first teleporting tennis shoes. The tennis shoes are efficient enough that, when a
Lampyridae Teleportae is spotted by its flash, there is always time to teleport once before the firefly itself teleports off to another location, but there is never time to teleport twice in a row before the firefly teleports away. The tennis shoes have a maximum teleport range, however, depending on how well their flux capacitor is constructed, so it's not always possible to catch a Lampyridae Teleportae with just a single teleport. The
most efficient catching method is to remain in place until a firefly flashes, and to then teleport in a straight line directly toward it, subject to the limitation of the maximum range of ones tennis shoes, in an attempt to get close enough to catch it. If you don't get close enough, you wait for the next flash, teleport towards it again, and repeat, until you either catch it or it's gone.
For this programming problem you will simulate this procedure for catching teleporting fireflies with a few simplifying assumptions:
(1) We will be chasing only one firefly at a time.
(2) Firefly chasing will take place in two dimensions where all units are considered to be yards.
(3) The firefly is "caught" if the chaser can manage to come within one yard of the firefly.
(4) The chaser's movement toward a firefly is always in a straight line from his or her current location directly toward the flash; if the range of the chaser's tennis shoes prevents getting close enough to catch the firefly, the chaser will always teleport the maximum range possible (thus, although the chaser always starts at integer coordinates, it is possible and likely that any or all of the chaser's locations after the first teleport will be at non-integer coordinates).
The input will consist of several chase scenarios. For each scenario you will be given the maximum range in yards of the chaser's teleporting tennis shoes, the chaser's starting location, and a list of one or more flash
locations for the firefly being chased. For each chase scenario your program will output a single line indicating either the flash location where the firefly was caught, or a message noting that the firefly was never caught.

Input
The first line of a chase scenario contains three numbers, delimited by a single space, in the following order: the maximum range in yards of the chaser's teleporting tennis shoes, the starting x-coordinate of the chaser, and the starting y-coordinate of the chaser. The maximum range will be a positive integer from 1 to 1000. The x and y values for the starting coordinates will be integers from 0 to 1000. The remaining lines of
an input scenario contain two integers each, an x-coordinate and a y-coordinate, again delimited by a single space. These are, in order of appearance, the locations where the firefly flashes. All coordinate values range from 0 to 1000. A line specifying a value of -1 for both x and y terminates the list, at which point we consider the firefly to disappear never to be seen again. Note that a firefly might be caught at a flash location prior to end of the list; in this case the rest of the flash locations listed in the input for the current chase scenario should simply be ignored.
The next input scenario begins on the line immediately after the last line of the preceding scenario. An input scenario that specifies 0 (zero) as the maximum range of the chaser will terminate the input.

Output
Every output line will be either:
(1) "Firefly N caught at (x,y)", where N is the input scenario number starting with 1, and (x,y) is the last location the firefly flashed before it was caught; or
(2) "Firefly N not caught".

Sample Input
2 0 0
3 3
4 4
5 5
6 6
7 7
-1 -1
2 0 0
3 3
5 5
7 7
-1 -1
10 50 50
50 62
40 55
30 55
45 45
50 50
55 55
50 50
-1 -1
0 0 0

Sample Output
Firefly 1 caught at (6,6)
Firefly 2 not caught
Firefly 3 caught at (50,50)

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

0
关于捕获的坐标的计算方式,采用C语言怎么才能实现的,思路的步骤
0
X, X+Z, X+2*Z, X+3*Z, …, X+K*Z, …(直到 (X+K*Z)<=Y). 循环推导 C语言
0
一个确定性的判定的算法,如何采用C语言进行计算,结果的分组谢谢
0
向量和欧几里得的距离的计算,求最短的距离,给定的点,采用C语言算法怎么实现
0
一个平面上角度和距离的计算的问题,采用C程序的编程怎么实现
0
从键盘输入一个表达式,计算其中包含的子表达式和操作数的个数,使用C语言求解谢谢大家
0
采用算法计算一个几何问题,计算围栏的长度怎么用C语言程序的实现的方式
2
字母的编码问题,相同的编码如何用c语言去合并成数字呢
0
谢谢,用C语言解决一个资源分配的问题,采用数据结构,xiexie
0
利用浮点数的数组,计算引力场的问题,采用C语言,结果保留一个小数位
0
一个收支平衡的计算的算法怎么使用数据结构和C语言的方式实现的呢?
0
C语言的程序设计技术运用,读取文件行,并且计算最小费用
0
利用C语言的程序设计的技术,计算这个图中的最长最短路径的算法怎么实现
0
下面这个人数的统计的运算的方式,采用C程序设计怎么解决呢?
0
路径搜索的问题,根据给出的节点进行路径的搜索,这采用C语言程序如何解决?
0
一个有关扑克牌的计算的问题,请问如何采用C程序编程技术实现的?
0
一个有关扑克牌的计算的问题,请问如何采用C程序编程技术实现的?
0
定义了结构体,用C语言实现数据的搜索查找的思路,谢谢
0
数据结构,无向图的遍历求解,判断其中的环,用C语言怎么实现的??
0
C语言实现一个日期的周期的推算的算法,怎么实现的,包括了思路谢谢