You live in a flat world and you have to carry some goods to three destinations A, B, C from a storeroom. You know the location of A, B and C and you have to find an optimal location G for the storeroom and build the storeroom at G.
But for carrying goods you have only one truck available and that can drive through any place/location you want. The truck will initially be located at G. But this truck is not large enough to carry goods for more than one place at a time. So for minimum path covering what you do is:
If you had known the location of G then to find the minimum driving length would have been very easy. But for this problem your job is to find a location of G for which the total path length would be minimum and report this minimum driving length.
The input file contains less than 11000 lines of input.
Each line contains six integer numbers Ax, Ay, Bx, By, Cx, Cy. You can assume that 0 <= Ax, Ay, Bx, By, Cx, Cy <= 1000). These integers denote that the location of A, B and C in two-dimensional Cartesian coordinate system is (Ax, Ay), (Bx, By) and (Cx, Cy) respectively.
A line containing six negative numbers terminates the input.
For each line of input except the last one produce one line of output. This line contains the serial of output followed by a floating-point number d, which denotes the minimum driving length needed from the optimal location of G. This number should have eight digits after the decimal point. Errors less than 10-7 will be ignored. Look at the output for sample input for details.
0 0 15 0 8 1 -1 -1 -1 -1 -1 -1
Case 1: 22.20439337
Info: 本題輸出為浮點數,絕對或相對誤差 1e-6 以下視為正確
Migrated from old NTUJ.
Regional Dhaka 2010
No. | Testdata Range | Score |
---|