Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: The Training of Chain Lightning
Description Chain Lightning is an advanced Lightning Magic and it is not very easy to master it. After casting this spell to a target, the chain lightning will find the nearest target which is not affected by previous chains and pass on through. So it is difficult to calculate when we need to hit a moving target by chains. Sram has failed in the test of Chain Lightning and it will cause great trouble if he failed again next week. His brother Mars decided to help him do some training. Since Sram can hit the first target precisely, now he should try to improve his calculating skill. Now Sram stands on (0,0) and there are Note that Mars’s speed is a real number and is in the range of (0, It is guaranteed that from a certain pillar, at most one pillar will be chosen as the next chain pillar. If Mars and other pillar have the same distance from the certain active pillar, Mars will definitely be hit-_-. Pillars on the positive X-axis will not block Mars’s way. Input There are multiple test cases. The first line of each case is an integer Output Output contains only an integer, representing the earliest time Mars will definitely be hit. If Mars can choose a speed so that chain lightning will never hit him, output -1 instead. Sample Input 3 100 10 50 0 100 0 -50 0 3 100 40 50 0 100 0 -50 0 0 Sample Output 2 -1 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator