编程介的小学生 2019-12-20 18:02 采纳率: 20.5%
浏览 68

Jogging 实现的思想

Description

It's Sunday, November 1, 2390, and Eddy has just been elected to the World Council. Of course, it is a very interesting and responsible job, and Eddy is eager to work in the Council, but there is a problem: Eddy is keen on sport. In particular, he likes jogging and he has been jogging at least thirty minutes each day of his life since he was a little boy. Now Eddy will have even less free time than ever before, when he was just a teacher. How will he find spare time for jogging?
Eddy decided that he would jog on his way to his work. Of course, the Council building is rather far away from his house, so he wants to combine jogging with travelling by public transport. Now it has to be told that the moving pathways are the only means of public transport in the Capital. Each line of pathways consists of a pair of straight pathways running in opposite directions with the same speed v1 > 0. These pathways are very long and relatively narrow, so for the purpose of this task they can be considered sharing an infinite straight line on the plane. Besides, for each pathway two numbers are given, Ti+and Ti- --- the time necessary for boarding and leaving this pathway. Note that crossing a pathway doesn't take any additional time, but changing from the i-th pathway to the j-th in their intersection point (which in fact is not an intersection since there are special bridges built at these points) takes exactly Ti- + Tj+ seconds.
Of course, Eddy wants to jog also on the pathways, so he'll move along the pathways with the ground speed v1 + v2 where v2 > 0 is the speed of Eddy while jogging on still ground.
Now he wants you to find a route from his house to the Council building that would require as little time as possible. This route should consist of several segments, some of which can lie on one of the existing pathways.
Input

The first line of input consists of a single integer N , 0 <= N <= 50 --- the number of pairs of moving pathways in the city. The second line contains six real numbers x1 , y1 , x2 , y2 , v1 , v2 , separated by spaces --- the coordinates of Eddy's house and of the Council building, and the speed of pathways and of Eddy respectively. Each of the next N lines contains a description of a pathway consisting of six real numbers xi1 , yi1 , xi2 , yi2 , Ti+ and Ti-, where (xi1 , yi1 ) and (xi2 , yi2 ) are two different points on the pathway and 0 <= Ti+ , Ti- <= 10 are the boarding and leaving times. All coordinates do not exceed 10000 by their absolute values, and v1 and v2 are real numbers ranging from 1 to 100. All pathways lie on different straight lines. Neither (x1 , y1 ) nor (x2 , y2 ) lie on any of the pathways.
Output

First line of output must contain one real number T --- the minimal travel time required. The second line must contain one integer 0 < M <= 300 --- the number of segments from which the optimal path is composed. Each of the next M lines should consist of one integer 0 <= kj <= N , the number of the pathway taken (0 means no pathway used), and of the coordinates Xj , Yj of the end of j-th segment of this path. All real numbers are to be output with six digits after decimal point.
Sample Input

2
-100 -100 200 100 2.92893219 7.07106781
0 0 1 0 0 0
2000 0 2000 1 0 0
Sample Output

50.000000
3
0 0.000000 0.000000
1 100.000000 0.000000
0 200.000000 100.000000

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮