You live in a small town with R bidirectional roads connecting C crossings and you want to go from crossing 1 to crossing C as soon as possible.
//你住在一个小镇,这个小镇有R条双向路连接着C个十字路口。现在你想以最短时间从路口1到路口C。
You can visit other crossings before arriving at crossing C, but it’s not mandatory.
//在到达C之前你可以穿过其他路口,但这不是强制的(可穿可不穿)
You have exactly one chance to ask your friend to repair exactly one existing road, from the time you leave crossing 1.
//你只有一次机会让你的朋友修已经存在的路中的一条,但这次机会要在离开路口1后使用。
If he repairs the i-th road for t units of time, the crossing time after that would be viai-t. It's not difficult to see that it takes vi units of time to cross that road if your friend doesn’t repair it.
//如果你的朋友花费t时间修第i条路,穿过时间会变成viai-t。不难看出,不修路通过的时间是vi.
You cannot start to cross the road when your friend is repairing it.
//你朋友还在修路的时候你就可以出发了
There will be at most 25 test cases. Each test case begins with two integers C and R (2<=C<=100, 1<=R<=500).
//最多25个测试样例。每个测试样例有两个整数C和R(2<=C<=100, 1<=R<=500)
Each of the next R lines contains two integers xi, yi (1<=xi, yi<=C) and two positive floating-point numbers vi and ai (1<=vi<=20,1<=ai<=5), indicating that there is a bidirectional road connecting crossing xi and yi, with parameters vi and ai (see above).
//接下来的R行每一行包括两个整数xi, yi (1<=xi, yi<=C) 和两个正浮点数vi 和 ai (1<=vi<=20,1<=ai<=5),表示这是一条连接xi和yi的路,带有参数vi和ai
Each pair of crossings can be connected by at most one road. The input is terminated by a test case with C=R=0, you should not process it.
//每一个接口最多连接一条路。输入以00结束
For each test case, print the smallest time it takes to reach crossing C from crossing 1, rounded to 3 digitsafter decimal point. It’s always possible to reach crossing C from crossing 1.
//每组样例,输出从1到C的最短时间,精确到小数点后3为。保证总能从1到C。
<span style="color:#333333"><span style="color:#333333">3 2
1 2 1.5 1.8
2 3 2.0 1.5
2 1
1 2 2.0 1.8
0 0
</span></span>
<span style="color:#333333"><span style="color:#333333">2.589
1.976</span></span>
Bidirectional 双向的
Mandatory 强制的
Existing 现存的
Unit 穿越的时间s
Integer 整数
Parameter 参数,限制因素,决定因素